home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Information / CSMP Digest / volume 3 / csmp-digest-v3-123 < prev    next >
Text File  |  1995-12-31  |  92KB  |  2,359 lines

  1. C.S.M.P. Digest             Fri, 24 Nov 95       Volume 3 : Issue 123
  2.  
  3. Today's Topics:
  4.  
  5.         Backgrounding during printing?
  6.         Books on programming in assembly?
  7.         Getting PC Exchange file names
  8.         Is this code necessary?
  9.         Memory move-purge and HLock Question???
  10.         Multiple frame buffers and page flipping
  11.         Photoshop "CLUT" into 'clut'
  12.         Question: Best format for saving region data?
  13.         Serial baud rates > 57.6KBaud?
  14.         [Q] Macsbug ATB in PPC apps?
  15.  
  16.  
  17.  
  18. The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
  19. (pottier@clipper.ens.fr).
  20.  
  21. The digest is a collection of article threads from the internet
  22. newsgroups comp.sys.mac.programmer.help, csmp.tools, csmp.misc and
  23. csmp.games. It is designed for people who read news semi-regularly and
  24. want an archive of the discussions.  If you don't know what a
  25. newsgroup is, you probably don't have access to it. Ask your systems
  26. administrator(s) for details. If you don't have access to news, you
  27. may still be able to post messages to the group by using a mail server
  28. like anon.penet.fi (mail help@anon.penet.fi for more information).
  29.  
  30. Each issue of the digest contains one or more sets of articles (called
  31. threads), with each set corresponding to a 'discussion' of a particular
  32. subject.  The articles are not edited; all articles included in this digest
  33. are in their original posted form (as received by our news server at
  34. nef.ens.fr).  Article threads are not added to the digest until the last
  35. article added to the thread is at least two weeks old (this is to ensure that
  36. the thread is dead before adding it to the digest).  Article threads that
  37. consist of only one message are generally not included in the digest.
  38.  
  39. The digest is officially distributed by two means, by email and ftp.
  40.  
  41. If you want to receive the digest by mail, send email to listserv@ens.fr
  42. with no subject and one of the following commands as body:
  43.     help                                Sends you a summary of commands
  44.     subscribe csmp-digest Your Name     Adds you to the mailing list
  45.     signoff csmp-digest                 Removes you from the list
  46. Once you have subscribed, you will automatically receive each new
  47. issue as it is created.
  48.  
  49. The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
  50. Questions related to the ftp site should be directed to
  51. scott.silver@dartmouth.edu.
  52.  
  53. -------------------------------------------------------
  54.  
  55. >From Spencer W Thomas <spencer@umich.edu>
  56. Subject: Backgrounding during printing?
  57. Date: 8 Nov 1995 07:43:25 GMT
  58. Organization: University of Michigan
  59.  
  60. This seems such an obvious question, I'm baffled that I haven't been able to
  61. find the answer in any of the Apple docs.  If I need to RTFM, just tell me
  62. which FM and I'll do it!
  63.  
  64. I'm developing an app that I would really like to be able to background while
  65. printing.  Since the print driver puts it's window frontmost, and it's a modal
  66. dialog, I can't.  But I figure there's GOT to be some trick I'm missing.
  67.  
  68. What is it?
  69.  
  70. Thanks.
  71. -- 
  72. =Spencer W. Thomas      |  SILS, 312 W. Engin.
  73.    Digital Libraries    |  Univ of Michigan, Ann Arbor, MI 48109
  74. spencer@umich.edu       |  313-764-5099, FAX 313-764-2475
  75.  
  76.  
  77. +++++++++++++++++++++++++++
  78.  
  79. >From Duane Murphy <dmurphy@bearriver.com>
  80. Date: Wed, 8 Nov 1995 16:09:20 GMT
  81. Organization: Bear River Associates
  82.  
  83. In article <47pn2t$224@srvr1.engin.umich.edu> Spencer W Thomas,
  84. spencer@umich.edu writes:
  85. >I'm developing an app that I would really like to be able to background while
  86. >printing.  Since the print driver puts it's window frontmost, and it's a modal
  87. >dialog, I can't.  But I figure there's GOT to be some trick I'm missing.
  88. >
  89. Spencer,
  90. No trick; no technique. The answer is simple. You cant do it ;-)
  91.  
  92. It turns out that the printing manager is (horribly) non-reentrant. So, 
  93. you cant print in the background. It must be the only thing operating.
  94.  
  95. Please, someone correct me if I'm wrong.
  96.  
  97. ...Duane
  98.  
  99. +++++++++++++++++++++++++++
  100.  
  101. >From dowdy@apple.com (Tom Dowdy)
  102. Date: Thu, 9 Nov 1995 17:20:03 GMT
  103. Organization: Apple Computer, Inc.
  104.  
  105. In article <DHqFJL.3y8@BearRiver.com>, Duane Murphy
  106. <dmurphy@bearriver.com> wrote:
  107.  
  108. > In article <47pn2t$224@srvr1.engin.umich.edu> Spencer W Thomas,
  109. > spencer@umich.edu writes:
  110. > >I'm developing an app that I would really like to be able to background while
  111. > >printing.  Since the print driver puts it's window frontmost, and it's
  112. a modal
  113. > >dialog, I can't.  But I figure there's GOT to be some trick I'm missing.
  114. > >
  115. > Spencer,
  116. > No trick; no technique. The answer is simple. You cant do it ;-)
  117. > It turns out that the printing manager is (horribly) non-reentrant. So, 
  118. > you cant print in the background. It must be the only thing operating.
  119. > Please, someone correct me if I'm wrong.
  120.  
  121. You're right, and you're wrong.  :-)
  122.  
  123. It's true that the old style PrXXX API doesn't allow this.
  124.  
  125. However, if you use the GX printing API, the spooling dialog is
  126. moveable modal, and the user can swap to the background.
  127.  
  128. The GX API is a one for one swap with the existing API, and quite
  129. easy to add to most applications conditionally.  SimpleText does
  130. it this way, and Dave Hersey had an article in _develop_ on how to
  131. add this to your application.
  132.  
  133. -- 
  134.  Tom Dowdy                  Internet: dowdy@apple.COM
  135.  Apple Computer MS:302-3KS  UUCP: {sun,voder,amdahl,decwrl}!apple!dowdy
  136.  1 Infinite Loop            AppleLink: DOWDY1
  137.  Cupertino, CA 95014       
  138.  "The 'Ooh-Ah' Bird is so called because it lays square eggs."
  139.  
  140. +++++++++++++++++++++++++++
  141.  
  142. >From opstad@apple.com (David Opstad)
  143. Date: 10 Nov 1995 08:51:33 -0800
  144. Organization: Apple Computer Inc, Cupertino, CA
  145.  
  146. In article <dowdy-0911950920030001@17.202.32.83>,
  147. Tom Dowdy <dowdy@apple.com> wrote:
  148. >
  149. >The GX API is a one for one swap with the existing API, and quite
  150. >easy to add to most applications conditionally.  SimpleText does
  151. >it this way, and Dave Hersey had an article in _develop_ on how to
  152. >add this to your application.
  153.  
  154. A Web version of this article may be found at this URL:
  155.  
  156. http://support.info.apple.com/gx/PRNT/Hersey.html
  157.  
  158. Dave Opstad
  159. GX Line Layout Weenie
  160.  
  161. +++++++++++++++++++++++++++
  162.  
  163. >From mclow@coyote.csusm.edu (Marshall Clow)
  164. Date: Wed, 08 Nov 1995 19:31:00 -0800
  165. Organization: Aladdin Systems
  166.  
  167. In article <47pn2t$224@srvr1.engin.umich.edu>, Spencer W Thomas
  168. <spencer@umich.edu> wrote:
  169. >I'm developing an app that I would really like to be able to background while
  170. >printing.  Since the print driver puts it's window frontmost, and it's a modal
  171. >dialog, I can't.  But I figure there's GOT to be some trick I'm missing.
  172. >
  173. The short answer is "You can't".
  174. While you can do some weirdness with patching NewWindow and changing the
  175. window type (or other bad things), it's not a good idea.
  176.  
  177. The basic problem is that the print manager is not re-entrant. If you are
  178. printing in the background, and another application brings up a print
  179. dialog, _somebody_ will crash. :-(
  180.  
  181. Of course, this is easy in QuickDraw GX.
  182.  
  183. -- Marshall
  184.  
  185. -- 
  186. "They that can give up essential liberty to obtain a little temporary
  187.  safety deserve neither liberty nor safety." -- Benjamin Franklin
  188.  _Historical Review of Pennsylvania_, 1759
  189.  
  190. ---------------------------
  191.  
  192. >From src@crl.com (James R Cantrell)
  193. Subject: Books on programming in assembly?
  194. Date: 5 Nov 1995 19:17:50 -0800
  195. Organization: CRL Dialup Internet Access        (415) 705-6060  [Login: guest]
  196.  
  197.    Anyone know any good books that go over how to program in assembly 
  198. language for the PPC?
  199.  
  200.  
  201. Thanks,
  202. Joshua Cantrell
  203. src@crl.com
  204. jjc@cory.berkeley.edu
  205.  
  206. +++++++++++++++++++++++++++
  207.  
  208. >From frank@bnkl01.astro.ucla.edu (Frank Henriquez)
  209. Date: Mon, 06 Nov 1995 12:52:09 -0800
  210. Organization: UCLA Astronomy Department
  211.  
  212. In article <47juou$77i@crl13.crl.com>, src@crl.com (James R Cantrell) wrote:
  213.  
  214. >   Anyone know any good books that go over how to program in assembly 
  215. >language for the PPC?
  216. >
  217. >
  218.  
  219. Joshua:
  220.   There's "Optimizing PowerPC Code" by Gary Kacmarcik (Addison Wesley ISBN
  221. 0-201-40839-2). It's not Mac specific, but it is a detailed book on the
  222. PPC assembly language. It's around $40.
  223.  
  224. I saw another PPC assembly book at a bookstore recently, but I forgot the
  225. title. It looked good, too.
  226.  
  227. Frank
  228.  
  229. -- 
  230. Frank Henriquez                  UCLA Astronomy Department
  231. frank@ucla.edu        -or-       frank@bnkl01.astro.ucla.edu
  232.  
  233. ---------------------------
  234.  
  235. >From piran@pobox.com (Piran Montford)
  236. Subject: Getting PC Exchange file names
  237. Date: Sat, 28 Oct 1995 19:50:37 +0100
  238. Organization: Auk Word Computing
  239.  
  240. Simple question:
  241.  
  242. how do I guess/calculate/find the name of Mac file when it's copied to a
  243. PC Disk using PC Exchange, or mounted using AppleShare client for Windows.
  244.  
  245. This information must be available, because if you do get info on a file
  246. name, and click on the file's name in the info window, it shows the PC
  247. version. However, I can't access this information.
  248.  
  249. I've worked out a system to convert file names to what they'll appear as,
  250. but if two files have similar names then it is determind by which is first
  251. in the catalogue, not alphabetic order. And I only seem to be able to pull
  252. out file names in alphabetical order.
  253.  
  254. Any suggestions?
  255.  
  256. atdhvaannkcse, Piran.
  257. --
  258. "I think ahead of you, I think instead of you." - Tricky
  259. Piran at home: mailto:piran@pobox.com,  http://pobox.com/~piran
  260. Piran at work: mailto:piran@cogapp.com
  261.  
  262. +++++++++++++++++++++++++++
  263.  
  264. >From jumplong@aol.com (Jump Long)
  265. Date: 3 Nov 1995 00:53:22 -0500
  266. Organization: America Online, Inc. (1-800-827-6364)
  267.  
  268. Piran Montford wrote:
  269.  
  270. >how do I guess/calculate/find the name of Mac file when it's
  271. >copied to a PC Disk using PC Exchange, or mounted using
  272. >AppleShare client for Windows.
  273.  
  274. You need to use the little-known call PBGetXCatInfo (note the "X"). The
  275. call is documented in the "Guide to the File System Manager" so that
  276. foreign file systems can implement it like AppleShare and the DOS file
  277. system in PC Exchange. If you have File Sharing running or a DOS disk
  278. mounted with PC Exchange, the "short name" returned by PBGetXCatInfo is
  279. what the Finder displays when you click on the filename shown in the "Get
  280. Info..." Finder dialog.
  281.  
  282. Apple II fans: Note that you also get the ProDOS file/aux type from this
  283. call :-)
  284.  
  285. I searched around on my hard disk for a snippet that uses PBGetXCatInfo
  286. and found the code that I've pasted below. (This'll probably piss off the
  287. Copland File System team since they have no plans to implement this call.)
  288.  
  289. - Jim Luther, former keeper of obscure File Manager knowledge
  290.  
  291. /*************************************************************************
  292. */
  293.  
  294. /* A few things that aren't in the interface files */
  295.  
  296. struct XCInfoPBRec {
  297.   QElemPtr  qLink;
  298.   short     qType;
  299.   short     ioTrap;
  300.   Ptr       ioCmdAddr;
  301.   ProcPtr   ioCompletion;   /* --> A pointer to a completion routine */
  302.   OSErr     ioResult;       /* --> The result code of the function */
  303.   StringPtr ioNamePtr;      /* --> Pointer to pathname to object */
  304.   short     ioVRefNum;      /* --> A volume specification */
  305.   long      filler1;
  306.   StringPtr ioShortNamePtr; /* <-> A pointer to the short name string
  307.                                    buffer - required! */
  308.   short     filler2;
  309.   short     ioPDType;       /* <-- The ProDOS file type */
  310.   long      ioPDAuxType;    /* <-- The ProDOS aux type */
  311.   long      filler[2];
  312.   long      ioDirID;        /* --> A directory ID */
  313. };
  314. typedef struct XCInfoPBRec XCInfoPBRec;
  315. typedef XCInfoPBRec *XCInfoPBPtr;
  316.  
  317. /*************************************************************************
  318. ****/
  319.  
  320. #pragma parameter __D0 PBGetXCatInfoSync(__A0)
  321. pascal OSErr PBGetXCatInfoSync(XCInfoPBPtr paramBlock)
  322.  = {0x703A,0xA260};
  323. #pragma parameter __D0 PBGetXCatInfoAsync(__A0)
  324. pascal OSErr PBGetXCatInfoAsync(XCInfoPBPtr paramBlock)
  325.  = {0x703A,0xA660};
  326.  
  327. /*************************************************************************
  328. ****/
  329.  
  330. pascal  OSErr  GetXCatInfo(short vRefNum,
  331.                            long dirID,
  332.                            StringPtr name,
  333.                            StringPtr shortName,
  334.                            short *ProDOSFileType,
  335.                            long *ProDOSAuxType);
  336. /* Use GetXCatInfo to retrieve the MS-DOS short name and ProDOS
  337.    file/aux type of the file or directory specified.
  338.   
  339.    vRefNum         input:  Volume specification.
  340.    dirID           input:  Directory ID.
  341.    name            input:  Pointer to object name, or nil when dirID
  342.                            specifies a directory that's the object.
  343.    shortName       input:  Points to a buffer (minimum String[12]) where
  344. the
  345.                            MS-DOS short name is to be returned. This
  346.                            *cannot* be nil.
  347.    ProDOSFileType output:  The ProDOS file type
  348.    ProDOSAuxType  output:  The ProDOS aux type
  349. */
  350.  
  351. pascal  OSErr  GetXCatInfo(short vRefNum,
  352.                            long dirID,
  353.                            StringPtr name,
  354.                            StringPtr shortName,
  355.                            short *ProDOSFileType,
  356.                            long *ProDOSAuxType)
  357. {
  358.   XCInfoPBRec pb;
  359.   OSErr result;
  360.  
  361.   /* The system always returns the short name, so the shortName buffer is
  362.      required */
  363.   if (shortName != nil)
  364.   {
  365.     pb.ioVRefNum = vRefNum;
  366.     pb.ioDirID = dirID;
  367.     pb.ioNamePtr = name;
  368.     pb.ioShortNamePtr = shortName;
  369.     result = PBGetXCatInfoSync(&pb);
  370.     *ProDOSFileType = pb.ioPDType;
  371.     *ProDOSAuxType = pb.ioPDAuxType;
  372.   }
  373.   else
  374.     result = paramErr;  /* no short name buffer */
  375.  
  376.   return (result);
  377. }
  378.  
  379. /*************************************************************************
  380. */
  381.  
  382. pascal  OSErr  FSpGetXCatInfo(const FSSpec *spec,
  383.                               StringPtr shortName,
  384.                               short *ProDOSFileType,
  385.                               long *ProDOSAuxType);
  386. /* Use FSpGetXCatInfo to retrieve the MS-DOS short name and ProDOS
  387.    file/aux type of the file or directory specified.
  388.   
  389.    spec            input:  An FSSpec record specifying the object.
  390.    shortName       input:  Points to a buffer (minimum String[12]) where
  391. the
  392.                            MS-DOS short name is to be returned. This
  393.                            *cannot* be nil.
  394.    ProDOSFileType output:  The ProDOS file type
  395.    ProDOSAuxType  output:  The ProDOS aux type
  396. */
  397.  
  398. pascal  OSErr  FSpGetXCatInfo(const FSSpec *spec,
  399.                               StringPtr shortName,
  400.                               short *ProDOSFileType,
  401.                               long *ProDOSAuxType)
  402. {
  403.   return (GetXCatInfo(spec->vRefNum, spec->parID, (StringPtr)spec->name,
  404.                       shortName, ProDOSFileType, ProDOSAuxType));
  405. }
  406.  
  407. /*************************************************************************
  408. */
  409.  
  410. +++++++++++++++++++++++++++
  411.  
  412. >From cwatson@cam.org (Sean McBride)
  413. Date: Fri, 10 Nov 1995 17:35:58 -0500
  414. Organization: Communications Accessibles Montreal, Quebec Canada
  415.  
  416. In article <47caoi$719@newsbf02.news.aol.com>, jumplong@aol.com (Jump
  417. Long) wrote:
  418.  
  419. >You need to use the little-known call PBGetXCatInfo (note the "X"). The
  420. >call is documented in the "Guide to the File System Manager" so that
  421. >foreign file systems can implement it like AppleShare and the DOS file
  422. >system in PC Exchange. If you have File Sharing running or a DOS disk
  423. >mounted with PC Exchange, the "short name" returned by PBGetXCatInfo is
  424. >what the Finder displays when you click on the filename shown in the "Get
  425. >Info..." Finder dialog.
  426. >
  427. >Apple II fans: Note that you also get the ProDOS file/aux type from this
  428. >call :-)
  429. >
  430. >I searched around on my hard disk for a snippet that uses PBGetXCatInfo
  431. >and found the code that I've pasted below. (This'll probably piss off the
  432. >Copland File System team since they have no plans to implement this call.)
  433.  
  434. So the File System Manager won't be available in Copland?  I guess that'd
  435. mean that PC Exchange won't work, at least not the current version.
  436.  
  437. I really hope that Copland will be able to read and write MS-DOS and
  438. ProDOS disks... I expect reading DOS disks will be available, but I fear
  439. they won't bother with ProDOS...
  440.  
  441. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  442.   H H      |                   |                                       |
  443.   | |      | Sean McBride      |                                       |
  444. H-C-C-O-H  | cwatson@cam.org   |   "Total destructive interference"    |
  445.   | |      | Montreal, Canada  |   "For Unlawful Carnal Knowledge"     |
  446.   H H      |                   |                                       |
  447. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  448.  
  449. ---------------------------
  450.  
  451. >From cws4@ra.msstate.edu (Chuck Stricklin)
  452. Subject: Is this code necessary?
  453. Date: Sat, 4 Nov 1995 00:15:03 GMT
  454. Organization: Mississippi State University
  455.  
  456. I've been looking over Apple's Pascal Sample 3.0B10 code and found this
  457. initialization code which I think may be outdated. Can anyone give me a
  458. reason why I should or shouldn't dump this code?
  459.  
  460. kMinHeap = 60 * 1024;
  461. kMinSpace = 24 * 1024;
  462. kPrefSize = 200;
  463. kMinSize = 180;
  464.  
  465. for count := 1 to 3 do
  466.  ignoreResult := EventAvail(everyEvent, event);
  467.  
  468. if ORD(GetApplLimit) - ORD(ApplicZone) < kMinHeap then
  469.  AlertUser(rNoMemoryForApp);
  470.  
  471. PurgeSpace(total, contig);
  472. if total < kMinSpace then
  473.  AlertUser(rNoMemoryForApp);
  474.  
  475. -- 
  476. "Giving money and power to government is like giving
  477. liquor and car keys and teenage boys." - P.J. O'Rourke
  478.  
  479. +++++++++++++++++++++++++++
  480.  
  481. >From bootstrp@vnet.net (Nathan Tennies)
  482. Date: Sat, 04 Nov 1995 17:42:40 -0400
  483. Organization: Bootstrap Enterprises Inc
  484.  
  485. In article <cws4-0311951815030001@port32.ts2.msstate.edu>,
  486. cws4@ra.msstate.edu (Chuck Stricklin) wrote:
  487.  
  488. > I've been looking over Apple's Pascal Sample 3.0B10 code and found this
  489. > initialization code which I think may be outdated. Can anyone give me a
  490. > reason why I should or shouldn't dump this code?
  491. > kMinHeap = 60 * 1024;
  492. > kMinSpace = 24 * 1024;
  493. > kPrefSize = 200;
  494. > kMinSize = 180;
  495. > for count := 1 to 3 do
  496. >  ignoreResult := EventAvail(everyEvent, event);
  497. > if ORD(GetApplLimit) - ORD(ApplicZone) < kMinHeap then
  498. >  AlertUser(rNoMemoryForApp);
  499. > PurgeSpace(total, contig);
  500. > if total < kMinSpace then
  501. >  AlertUser(rNoMemoryForApp);
  502.  
  503. Well, I don't know what the history of the EventAvail loop is, or exactly
  504. what it does.  All I know is that two of my apps had the problem of the
  505. splash window appearing _behind_ all the other open windows in other
  506. programs untl I put this loop in.  Then everything worked fine.  I'm
  507. guessing that maybe the Finder doesn't bring the app's window layer to the
  508. front until it senses that it is receiving events.  You got me.
  509.  
  510. The first if/then/alert phrase is used to guarantee that your app has the
  511. minimum amount of memory it needs to operate successfully.  Your first
  512. line of defence against this are the MinSize fields in SIZE resources,
  513. which sets the minimum amount of memory the OS allocates to your app when
  514. launched.  However, since the user can override this amount, this code
  515. guarantees that your app won't run unless it has enough RAM.
  516.  
  517. Also, this code is checking for a different value than the MinSize field
  518. of the SIZE resource does.  I think the MinSize field may be spcifying the
  519. minimum size of the entire chunk of RAM allocated to an app, which
  520. includes both the stack and heap.  However, this code is checking
  521. specifically for a minimum size of the heap alone.  The only reason I can
  522. think of why this is done this way is in case different systems allocate
  523. different amounts of memory for the stack, which will eat into the minimum
  524. amount available for the heap (can anyone verify this?).  Finally, make
  525. sure you're using those newfangled doohickey "accessor" functions (or
  526. whatever they're called) in place of accessing the low-level global
  527. variables directly.
  528.  
  529. The second if/then/alert phrase is used to gurantee a similar quality; the
  530. amount of heap space availablek, including purgeable blocks, after the
  531. program is loaded and running.  This will be less than the total block
  532. size measured in the first if/then/alert phrase, since any unpurgeable
  533. code and automatically loaded resources will be use up some of that
  534. memory.  This could be useful, I'd guess, in the case where you have a FAT
  535. version of your app in which the PowerPC code will all be loaded in
  536. one-fell swoop (and will be bigger at that) whereas the 68K code will
  537. still be loaded piecemeal (and will be more compact).  In either case,
  538. you'd want to guarantee that you had X amount of memory available for the
  539. program to run correctly.
  540.  
  541. Frankly, I think I'd tend to use just the second of these if/then/alert
  542. phrases, since it more accurately measures the quantity that is probably
  543. of greatest interest.  I'd probably preceed this phrase with a call to
  544. MaxApplZone.
  545.  
  546. If anyone can think of a good reason to include _both_ of these
  547. if/then/alert phrases, I'd like to know.
  548.  
  549. Nathan Tennies
  550. Bootstrap Enterprises Inc
  551.  
  552. +++++++++++++++++++++++++++
  553.  
  554. >From dstone@chem.utoronto.ca (David Stone)
  555. Date: Mon, 6 Nov 1995 13:58:38 GMT
  556. Organization: University of Toronto Chemistry
  557.  
  558. In article <bootstrp-0411951742400001@bootstrap.vnet.net>,
  559. bootstrp@vnet.net (Nathan Tennies) wrote:
  560. ======big snip======
  561. > Also, this code is checking for a different value than the MinSize field
  562. > of the SIZE resource does.  I think the MinSize field may be spcifying the
  563. > minimum size of the entire chunk of RAM allocated to an app, which
  564. > includes both the stack and heap.  However, this code is checking
  565. > specifically for a minimum size of the heap alone.  The only reason I can
  566. > think of why this is done this way is in case different systems allocate
  567. > different amounts of memory for the stack, which will eat
  568.  
  569. This rings a bell - I'm pretty sure that the default stack/heap split
  570. on the MacPlus is different to, say, a Mac II etc.  I have a note
  571. on this at home, so I'll check later.  I know that to get around this
  572. in one of my own apps. I explicitly adjusted the heap limit to get the
  573. required amount of stack space.
  574.  
  575. Dave Stone
  576.  
  577. +++++++++++++++++++++++++++
  578.  
  579. >From lsr@taligent.com (Larry Rosenstein)
  580. Date: Wed, 08 Nov 1995 17:53:47 -0900
  581. Organization: Taligent, Inc.
  582.  
  583. In article <bootstrp-0411951742400001@bootstrap.vnet.net>,
  584. bootstrp@vnet.net (Nathan Tennies) wrote:
  585.  
  586. >In article <cws4-0311951815030001@port32.ts2.msstate.edu>,
  587. >cws4@ra.msstate.edu (Chuck Stricklin) wrote:
  588. >
  589. >> I've been looking over Apple's Pascal Sample 3.0B10 code and found this
  590. >> initialization code which I think may be outdated. Can anyone give me a
  591. [code omitted]
  592.  
  593. >Well, I don't know what the history of the EventAvail loop is, or exactly
  594. ...
  595. >guessing that maybe the Finder doesn't bring the app's window layer to the
  596. >front until it senses that it is receiving events.  You got me.
  597.  
  598. That's right.  
  599.  
  600. >specifically for a minimum size of the heap alone.  The only reason I can
  601. >think of why this is done this way is in case different systems allocate
  602. >different amounts of memory for the stack, which will eat into the minimum
  603.  
  604. That's right.  The minimum heap is larger on machine with Color Quickdraw,
  605. for example.
  606.  
  607. >Frankly, I think I'd tend to use just the second of these if/then/alert
  608. >phrases, since it more accurately measures the quantity that is probably
  609. >of greatest interest.  I'd probably preceed this phrase with a call to
  610. >MaxApplZone.
  611.  
  612. I agree.  There's probably no good reason for both, provided kMinSpace is
  613. made large enough.  
  614.  
  615. (Consider the situations in which the first check would fail but the
  616. second succeed.   That would mean that the heap size was too small, but
  617. the amount of free space was OK.)
  618.  
  619. -- 
  620. Larry Rosenstein
  621. Taligent, Inc.
  622.  
  623. lsr@taligent.com
  624.  
  625. ---------------------------
  626.  
  627. >From "Paul N. Taylor" <comrpnt@herts.ac.uk>
  628. Subject: Memory move-purge and HLock Question???
  629. Date: Wed, 8 Nov 1995 15:19:02 +0000
  630. Organization: University of Hertfordshire
  631.  
  632. Hi all,
  633.         I would like to know when to use 'purge' in resource definitions 
  634. (i.e: in resedit) and when not to use it. Also, the recommended use for 
  635. HLock/HUnlock. Does it have to be used with all routines quoted in IM???
  636.  
  637. The reason for this request for info is because I keep getting random crashes
  638. of some software of mine (Macbugs error: Spurious Interrupt....???).
  639.  
  640. Could this be a memory purge on something currently in use by the 
  641. processor???
  642.  
  643. Needless to say, help! Someones experiences in this area would help as 
  644. I'm a bit new to the finer points of locking out changes and purging.
  645.  
  646. Thanks in advance, regards,
  647.  
  648. P.T.
  649.  
  650. comrpnt@herts.ac.uk
  651.  
  652.  
  653.  
  654. +++++++++++++++++++++++++++
  655.  
  656. >From devon@apple.com (Devon Hubbard)
  657. Date: Wed, 08 Nov 1995 14:39:08 -0800
  658. Organization: Apple Computer
  659.  
  660. In article <Pine.SUN.3.91.951108151259.11048A-100000@altair.herts.ac.uk>,
  661. "Paul N. Taylor" <comrpnt@herts.ac.uk> wrote:
  662.  
  663. > I would like to know when to use 'purge' in resource definitions 
  664. > (i.e: in resedit) and when not to use it. Also, the recommended use for 
  665. > HLock/HUnlock. Does it have to be used with all routines quoted in IM???
  666.  
  667. Asking when to use and not use 'purged' flags on a resource is really a
  668. loaded question.  It all depends on your application, the size of it's
  669. heap, and what you have going on in that heap.  If you have some dialog,
  670. pict, string, etc. that only comes up maybe once in the entire user
  671. experience then make it's contents purgeable so when the user doesn't have
  672. that dialog up the memory it uses can be purged and available to something
  673. else.  Back when 8, 16, and 24 mb Macs weren't so common, purgeable heap
  674. blocks was more of an issue.  These days it's not such a big deal and
  675. [sadly] a lot of developers just up their heap size instead of finding the
  676. cause of some heap related problem.  If you have something that is
  677. referenced a lot in your application, don't mark it purgeable because
  678. you'll just end up reading it back again on the next reference.  But if
  679. it's something you only use one or twice (or occassionally), then mark it
  680. purgeable so it'll go away if needed.  BE VERY CAREFUL with your
  681. references to handles that are marked purgeable.  Check (i.e. 'if (!*h)' )
  682. to make sure the data is there before using it, otherwise LoadResource()
  683. the handle again if it's been purged or you're going to run into trouble. 
  684. Depending on what the resource was, you could not see garbage in a window
  685. (strings, picts, icons, etc.) or you could crash if it's data or something
  686. where it's absence is lethal to your app.
  687.  
  688. > The reason for this request for info is because I keep getting random crashes
  689. > of some software of mine (Macbugs error: Spurious Interrupt....???). 
  690. > Could this be a memory purge on something currently in use by the 
  691. > processor???
  692.  
  693. It definetely could be.  It could unfortunately be quite a lot of things. 
  694. Is the error reproducible?  If so, then there's 90% of the work right
  695. there.  Creating a reproducible case is very important because you can
  696. then walk backwards to the cause.  Obviously that can take 10 minutes or
  697. 10 hours depending on what the heck is going on.
  698.  
  699. I'd really like to suggest you try a tool called QC(tm) from Onyx
  700. Technology. We could write back and forth for a long time slowly isolating
  701. the cause of your problems, or you can use QC which was specifically
  702. designed to help you track down memory related problems like this.  See
  703. <http://www.std.com/onyxtech/> for details.  There's a fully functional
  704. demo available so you really can't lose for trying because it's free.  The
  705. demo, that is.
  706.  
  707. I'd be happy to try and help you figure out what's happening in your app,
  708. as I'm sure many others here on csmp would be.
  709.  
  710. Cheers,
  711. dEVoN
  712.  
  713. ---------------------------
  714.  
  715. >From ianm@netgrp.net (Ian McLean)
  716. Subject: Multiple frame buffers and page flipping
  717. Date: 3 Nov 1995 05:37:41 GMT
  718. Organization: Internet Communications Group
  719.  
  720. Okay, now that I've flamed CodeWarrior a bit (aah, felt good; relieved some
  721. stress; all in all I think it's a pretty good development environment
  722. though) and gotten some good advice about alternative compilers, I've got a
  723. more technical topic: high performance blitting on the Mac.
  724.  
  725. Is it possible?  Right now I'm working on a side scrolling game that, every
  726. frame, renders a span buffer into an off-screen bitmap, then CopyBits() to
  727. the screen.  I assume that CopyBits() waits for a vertical retrace before
  728. blitting, as I don't seem to have any tearing problems.  So, this method
  729. works, but it seems terribly inefficient.
  730.  
  731. I would like to implement some double or, preferably, triple buffering
  732. scheme.  This would mean I'd render the span buffer right into video memory,
  733. and then make that the currently visible frame by programming a video chip
  734. register, eliminating the overhead of transfering the bitmap to the video
  735. card in the CopyBits() call.  Is this possible?  I have no clue how the
  736. Macintosh video architecture works.  Is it possible to change the video
  737. resolution and bit depth, take control of the entire video display, and
  738. access it directly?  Oh, this games runs in 512x384 256-color mode, by the
  739. way (it'll run in 640x480 with unused borders around the gameplay area).
  740.  
  741. The Windows version of this product will be doing things with a double-
  742. buffer, rendering directly to video memory using Windows 95 DirectDraw, and
  743. I'd love for the Mac to be able to do something similar.  Anyone have any
  744. suggestions or feel like giving me a quick tutorial on Mac video modes?
  745.  
  746.                                 Thanks,
  747.                                   Ian McLean
  748.                                   Cyberflix, Inc.
  749.  
  750.  
  751. +++++++++++++++++++++++++++
  752.  
  753. >From gk1@acpub.duke.edu (Gavin Kistner)
  754. Date: Sat, 04 Nov 1995 17:40:39 -0500
  755. Organization: Image Refinery Productions, Inc.
  756.  
  757. In article <47c9r5$3q5@grover.netgrp.net>, ianm@netgrp.net (Ian McLean) wrote:
  758. [snip]
  759. >I would like to implement some double or, preferably, triple buffering
  760. >scheme.  This would mean I'd render the span buffer right into video memory,
  761. >and then make that the currently visible frame by programming a video chip
  762. >register, eliminating the overhead of transfering the bitmap to the video
  763. [snip]
  764.  
  765. Marathon (the original, and I assume 2) uses this, but...
  766. I believe that this was possible on the Quadra 630 (oslt) and is not
  767. possible on any other mac.  Someone PLEASE correct me if I'm wrong here. 
  768.  
  769. - Gavin
  770. ___________________________________________________________
  771. Gavin Kistner, aka RabYak, aka !Bob          (919) 613-0877
  772. <-> Graphics Designer, Image Refinery Productions, Inc. <->
  773. gk1@acpub.duke.edu       ftp/finger to phrogz.dorm.duke.edu
  774.  
  775. +++++++++++++++++++++++++++
  776.  
  777. >From mick@emf.net (Mick Foley)
  778. Date: Sat, 04 Nov 1995 22:59:01 -0800
  779. Organization: "emf.net" Quality Internet Access.  (510) 704-2929 (Voice)
  780.  
  781. In article <47c9r5$3q5@grover.netgrp.net>, ianm@netgrp.net (Ian McLean) wrote:
  782.  
  783. > Is it possible?  Right now I'm working on a side scrolling game that, every
  784. > frame, renders a span buffer into an off-screen bitmap, then CopyBits() to
  785. > the screen.  I assume that CopyBits() waits for a vertical retrace before
  786. > blitting, as I don't seem to have any tearing problems.  So, this method
  787. > works, but it seems terribly inefficient.
  788.  
  789. CopyBits does not wait for the vertical blank -- you can get tearing with
  790. it. If you want to sync with the VBL it is somewhat tricky. Not hard, but
  791. there are a lot of small details. And it's a b***h to debug.
  792.  
  793. > I would like to implement some double or, preferably, triple buffering
  794. > scheme.  This would mean I'd render the span buffer right into video memory,
  795. > and then make that the currently visible frame by programming a video chip
  796. > register, eliminating the overhead of transfering the bitmap to the video
  797. > card in the CopyBits() call.  Is this possible?  I have no clue how the
  798. > Macintosh video architecture works.  Is it possible to change the video
  799. > resolution and bit depth, take control of the entire video display, and
  800. > access it directly?  Oh, this games runs in 512x384 256-color mode, by the
  801. > way (it'll run in 640x480 with unused borders around the gameplay area).
  802.  
  803. I'll answer these one by one. Page Flipping -- no luck. There is no
  804. standard interface for this and most video hardware (cards and built-in)
  805. do not support it. There is a very slick way of faking two video pages
  806. with 16 colors each -- its used in Arashi. Basicly, if you cocider the 256
  807. color map as a 16 by 16 grid of colors. If you have two color tables, one
  808. the same color horizontally, one with the same colors vertically --
  809.  
  810. 0000000000000000
  811. 1111111111111111
  812. 2222222222222222
  813. 3333333333333333
  814. 4444444444444444
  815. 5555555555555555
  816. 6666666666666666
  817. 7777777777777777
  818. 8888888888888888
  819. 9999999999999999
  820. AAAAAAAAAAAAAAAA
  821. BBBBBBBBBBBBBBBB
  822. CCCCCCCCCCCCCCCC
  823. DDDDDDDDDDDDDDDD
  824. EEEEEEEEEEEEEEEE
  825. FFFFFFFFFFFFFFFF
  826.  
  827. 0123456789ABCDEF
  828. 0123456789ABCDEF
  829. 0123456789ABCDEF
  830. 0123456789ABCDEF
  831. 0123456789ABCDEF
  832. 0123456789ABCDEF
  833. 0123456789ABCDEF
  834. 0123456789ABCDEF
  835. 0123456789ABCDEF
  836. 0123456789ABCDEF
  837. 0123456789ABCDEF
  838. 0123456789ABCDEF
  839. 0123456789ABCDEF
  840. 0123456789ABCDEF
  841. 0123456789ABCDEF
  842. 0123456789ABCDEF
  843.  
  844. This effectivly divides each pixel into two four bit "colors". You can
  845. modify the "color" that is not being shown, then change the color table
  846. and the image will change instantly. However, this will not work for more
  847. than 16 color art.
  848.  
  849. Bit depth, no problem. You may however want to ask your user first. Screen
  850. resolution, I think that there is an API for this. If not now, one will be
  851. available soon. Hiding the menu bar is not too hard -- find sample code
  852. and use it.
  853.  
  854. A couple of final notes -- You should handle the case of multiple screens.
  855. Preferably, you users should be able to select a screen. If not that, make
  856. sure that all of your graphics go to the main screen (the one with menu
  857. bar). Also, look at QuickTime 2.1, I think it has an API for seting "whole
  858. screen" operations.
  859.  
  860. Mick
  861.  
  862. +++++++++++++++++++++++++++
  863.  
  864. >From phixus@deltanet.com (Chris De Salvo)
  865. Date: Sun, 05 Nov 1995 21:41:18 -0800
  866. Organization: MacPlay
  867.  
  868. >I would like to implement some double or, preferably, triple buffering
  869. >scheme.  This would mean I'd render the span buffer right into video memory,
  870. >and then make that the currently visible frame by programming a video chip
  871. >register, eliminating the overhead of transfering the bitmap to the video
  872. >card in the CopyBits() call.  Is this possible?  I have no clue how the
  873. >Macintosh video architecture works.  Is it possible to change the video
  874. >resolution and bit depth, take control of the entire video display, and
  875. >access it directly?  Oh, this games runs in 512x384 256-color mode, by the
  876. >way (it'll run in 640x480 with unused borders around the gameplay area).
  877.  
  878. Unless you are coding the Valkyrie chip directly (which is only available
  879. on a few Macs) then there is no such thing as page flipping.  You have one
  880. frame buffer and that is it.  Any other buffering scheme you have to do
  881. yourself.  However, you have a nice wide bus to video memory on the
  882. majority of machines (especially PowerMacs) and you can get some very fast
  883. frame rates.
  884.  
  885. Changing the video bit-depth is trivial, look at the call SetDepth(). 
  886. Changing the video resolution is a little trickier and requires that you
  887. go through the Display Manager.  Also, in Quicktime 2.1 there is a new
  888. call BeginFullscreenMode() that lets you define a horizontal and vertical
  889. resolution and it will try to adjust the screen size for you and creates a
  890. new window for you to fill that area.
  891.  
  892. >The Windows version of this product will be doing things with a double-
  893. >buffer, rendering directly to video memory using Windows 95 DirectDraw, and
  894. >I'd love for the Mac to be able to do something similar.  Anyone have any
  895. >suggestions or feel like giving me a quick tutorial on Mac video modes?
  896.  
  897. I suggest that you read, Inside Macintosh:  Imaging with Quickdraw.  I
  898. think that it will clear a few things up for you.
  899.  
  900. L8R
  901. Chris
  902.  
  903. -- 
  904. phixus@deltanet.com         |   Macintosh:  Changing the world,
  905. Chris De Salvo              |        one person at a time!
  906. Professional Mac Geek       |    -----------------------------
  907. for MacPlay, Inc.           |      (I wish they'd hurry up!)
  908.  
  909.            http://www.deltanet.com/users/phixus
  910.  
  911. +++++++++++++++++++++++++++
  912.  
  913. >From brychcy@nixe.informatik.tu-muenchen.de (Till Brychcy)
  914. Date: 06 Nov 1995 14:58:43 GMT
  915. Organization: Technische Universitaet Muenchen, Germany 
  916.  
  917. In article <phixus-0511952141180001@ana3101.deltanet.com> phixus@deltanet.com (Chris De Salvo) writes:
  918. [...]
  919.    Unless you are coding the Valkyrie chip directly (which is only available
  920.    on a few Macs) then there is no such thing as page flipping. 
  921. [...]
  922.  
  923. Where can I find information about how to do this? I couldn't find
  924. anything about it on the developer documentation cd-rom.
  925.  
  926. -- 
  927. - -----------------------------------------------------------------------
  928. Till Brychcy                    e-mail: brychcy@informatik.tu-muenchen.de
  929. Fakult"at f"ur Informatik
  930. Technische Universit"at M"unchen                    Tel: +49 89 2105 8476
  931. 80290 Munich, Germany                               Fax: +49 89 2105 8207
  932.  
  933.  
  934. +++++++++++++++++++++++++++
  935.  
  936. >From alexr@apple.com (Alex Rosenberg)
  937. Date: Mon, 06 Nov 1995 19:34:47 -0800
  938. Organization: Hackers Anonymous
  939.  
  940. In article <phixus-0511952141180001@ana3101.deltanet.com>,
  941. phixus@deltanet.com (Chris De Salvo) wrote:
  942.  
  943. >Unless you are coding the Valkyrie chip directly (which is only available
  944. >on a few Macs) then there is no such thing as page flipping.  You have one
  945. >frame buffer and that is it.  Any other buffering scheme you have to do
  946. >yourself.  However, you have a nice wide bus to video memory on the
  947. >majority of machines (especially PowerMacs) and you can get some very fast
  948. >frame rates.
  949.  
  950. This is not entirely true. "Designing Cards and Drivers for the Macintosh
  951. Family" documents video driver calls to find out how many pages are
  952. available for a given mode, what the current page is, where a given page
  953. is located, and to switch to a given page. They are supported on some
  954. video cards. The usual case is that the user has onboard video and does
  955. not have more than one page. The other major limitation here is that Apple
  956. never defined video modes like 320x240, even though cards actually support
  957. them. This is why there are makeshift calls to get around this, much as
  958. you find in QuickTime.
  959.  
  960. The technique for page flipping with the "Valkyrie" chip is to make use of
  961. it's video overlay capabilities to create two pages at 320x240 and flip
  962. between them. You'll find that several PCI video cards also support video
  963. overlays that can be used this way as well as direct support for page
  964. flipping, so you'll see increasing support for page flipping techniques in
  965. the future.
  966.  
  967. - -------------------------------------------------------------------------
  968. -  Alexander M. Rosenberg  - INTERNET: alexr@apple.com      - Yoyodyne    -
  969. -  330 Waverley St., Apt B - UUCP:ucbvax!apple!alexr        - Propulsion  -
  970. -  Palo Alto, CA 94301     -                                - Systems     -
  971. -  (415) 329-8463          - Nobody is my employer so       - :-)         -
  972. -  (408) 974-3110          - nobody cares what I say.       -             -
  973.  
  974. +++++++++++++++++++++++++++
  975.  
  976. >From phixus@deltanet.com (Chris De Salvo)
  977. Date: Mon, 06 Nov 1995 21:08:59 -0800
  978. Organization: MacPlay
  979.  
  980. In article <BRYCHCY.95Nov6155843@nixe.informatik.tu-muenchen.de>,
  981. brychcy@nixe.informatik.tu-muenchen.de (Till Brychcy) wrote:
  982.  
  983. >In article <phixus-0511952141180001@ana3101.deltanet.com>
  984. phixus@deltanet.com (Chris De Salvo) writes:
  985. >[...]
  986. >   Unless you are coding the Valkyrie chip directly (which is only available
  987. >   on a few Macs) then there is no such thing as page flipping. 
  988. >[...]
  989. >
  990. >Where can I find information about how to do this? I couldn't find
  991. >anything about it on the developer documentation cd-rom.
  992.  
  993. You need to talk with Apple directly about it.  The Valkyrie chip has no
  994. official API.  It's only available on a handful of models and is meant
  995. mainly for inbound video digitizer work, not as a page-flipping/scaling
  996. chip.
  997.  
  998. L8R
  999. Chris
  1000.  
  1001. -- 
  1002. phixus@deltanet.com         |   Macintosh:  Changing the world,
  1003. Chris De Salvo              |        one person at a time!
  1004. Professional Mac Geek       |    -----------------------------
  1005. for MacPlay, Inc.           |      (I wish they'd hurry up!)
  1006.  
  1007.            http://www.deltanet.com/users/phixus
  1008.  
  1009. +++++++++++++++++++++++++++
  1010.  
  1011. >From dwareing@adelaide.on.net (David Wareing)
  1012. Date: Tue, 07 Nov 1995 12:46:38 +1100
  1013. Organization: Weyland Yutani
  1014.  
  1015. In article <gk1-0411951740400001@west-111-103.dorm.duke.edu>,
  1016. gk1@acpub.duke.edu (Gavin Kistner) wrote:
  1017.  
  1018. >In article <47c9r5$3q5@grover.netgrp.net>, ianm@netgrp.net (Ian McLean) wrote:
  1019. >[snip]
  1020. >>I would like to implement some double or, preferably, triple buffering
  1021. >>scheme.  This would mean I'd render the span buffer right into video memory,
  1022. >>and then make that the currently visible frame by programming a video chip
  1023. >>register, eliminating the overhead of transfering the bitmap to the video
  1024. >[snip]
  1025. >
  1026. >Marathon (the original, and I assume 2) uses this, but...
  1027. >I believe that this was possible on the Quadra 630 (oslt) and is not
  1028. >possible on any other mac.  Someone PLEASE correct me if I'm wrong here. 
  1029.  
  1030. The PCI Macs also use the 'Valkyrie' graphics chipset too I believe.
  1031. At least the 7200 does. However, accessing this hardware is another 
  1032. matter altogether. I don't know of any API from Apple. There also seems
  1033. to be other limitations - you need to be in 16bit mode, and Dale Adams
  1034. (designer of the 7200 hardware) suggested that the page flipping hardware
  1035. will only run with Virtual Memory off because of "contigous memory"
  1036. reasons. And I don't know about this, but I suspect that it would only
  1037. work on a PCI Mac with a 64bit data path to memory (the stock 7200 needs
  1038. another 1Mb VRAM installed for this).
  1039.  
  1040. -- 
  1041. --
  1042. David Wareing                         dwareing@adelaide.on.net
  1043. Belair, South Australia           dwareing@apanix.apana.org.au
  1044. Macintosh Games & Multimedia Programming
  1045.  
  1046. +++++++++++++++++++++++++++
  1047.  
  1048. >From mcmurtri@wco.com (Kevin McMurtrie)
  1049. Date: Mon, 06 Nov 1995 22:54:18 -0700
  1050. Organization: WEST COAST ONLINE
  1051.  
  1052. In article <47c9r5$3q5@grover.netgrp.net>, ianm@netgrp.net (Ian McLean) wrote:
  1053.  
  1054. >Okay, now that I've flamed CodeWarrior a bit (aah, felt good; relieved some
  1055. >stress; all in all I think it's a pretty good development environment
  1056. >though) and gotten some good advice about alternative compilers, I've got a
  1057. >more technical topic: high performance blitting on the Mac.
  1058. >
  1059. >Is it possible?  Right now I'm working on a side scrolling game that, every
  1060. >frame, renders a span buffer into an off-screen bitmap, then CopyBits() to
  1061. >the screen.  I assume that CopyBits() waits for a vertical retrace before
  1062. >blitting, as I don't seem to have any tearing problems.
  1063.  
  1064. No, it doesn't wait.
  1065.  
  1066. >So, this method
  1067. >works, but it seems terribly inefficient.
  1068. >
  1069. >I would like to implement some double or, preferably, triple buffering
  1070. >scheme.  This would mean I'd render the span buffer right into video memory,
  1071. >and then make that the currently visible frame by programming a video chip
  1072. >register, eliminating the overhead of transfering the bitmap to the video
  1073. >card in the CopyBits() call.  Is this possible?  I have no clue how the
  1074. >Macintosh video architecture works.  Is it possible to change the video
  1075. >resolution and bit depth, take control of the entire video display, and
  1076. >access it directly?  Oh, this games runs in 512x384 256-color mode, by the
  1077. >way (it'll run in 640x480 with unused borders around the gameplay area).
  1078. >
  1079. >The Windows version of this product will be doing things with a double-
  1080. >buffer, rendering directly to video memory using Windows 95 DirectDraw, and
  1081. >I'd love for the Mac to be able to do something similar.  Anyone have any
  1082. >suggestions or feel like giving me a quick tutorial on Mac video modes?
  1083. >
  1084. >                                Thanks,
  1085. >                                  Ian McLean
  1086. >                                  Cyberflix, Inc.
  1087.  
  1088. Mac video hardware varies quite a bit, especially when you consider all of
  1089. the weird NuBus cards that existed before built-in video. I've also had
  1090. plenty of games try to set my HPV card to 4 bits and crash.  Some cheap
  1091. cards only run in 15 or 24 bits.  It is even possible that you can't set
  1092. the depth and resolution you want but CopyBits will have hardware
  1093. acceleration to make the match.  You never know.
  1094.  
  1095. CopyBits is very fast if you know how to make it happy.  If you can't make
  1096. it happy on strange cards it may run slowly, but at least it will still
  1097. run.  Tips are available in books and may still be periodicly posted in
  1098. programming groups.
  1099.  
  1100. +++++++++++++++++++++++++++
  1101.  
  1102. >From chrisat@ids.net (Chris Arsenault)
  1103. Date: Tue, 07 Nov 1995 15:25:03 -0500
  1104. Organization: SandCastle Studios
  1105.  
  1106. In article <47c9r5$3q5@grover.netgrp.net>, ianm@netgrp.net (Ian McLean) wrote:
  1107.  
  1108. > I've got a more technical topic: high performance blitting on the Mac.
  1109. > Is it possible?  Right now I'm working on a side scrolling game that, every
  1110. > frame, renders a span buffer into an off-screen bitmap, then CopyBits() to
  1111. > the screen.  I assume that CopyBits() waits for a vertical retrace before
  1112. > blitting, as I don't seem to have any tearing problems.  So, this method
  1113. > works, but it seems terribly inefficient.
  1114.  
  1115. CopyBits doesn't wait for a vertical retrace before copying. You can
  1116. install your own VBL Task and synch it up with the retrace on a specific
  1117. display.  You would definately see some tearing on the lower end systems.
  1118.  
  1119. > I would like to implement some double or, preferably, triple buffering
  1120. > scheme.  This would mean I'd render the span buffer right into video memory,
  1121. > and then make that the currently visible frame by programming a video chip
  1122. > register, eliminating the overhead of transfering the bitmap to the video
  1123. > card in the CopyBits() call.  Is this possible? 
  1124.  
  1125. Currently it is not possible to reset Macintosh display memory through
  1126. redirection in a video register.  There is a hardware blitting mechanism
  1127. in some systems, notably the 630, but it's not available as a common
  1128. feature.
  1129.  
  1130. > Is it possible to change the video resolution and bit depth, 
  1131. > take control of the entire video display, and access it directly?
  1132.  
  1133. Yes, but you have to remember things like the Mac being able to use
  1134. several video displays at one time.  You also want to make sure that you
  1135. maintain that Mac look and feel. :-)  
  1136.  
  1137. In some cases you can generate a tremendous performance improvement by
  1138. directly accessing video memory.  It depends on where you need to put your
  1139. development time.  Optimizing video memory access with the various
  1140. versions of the PowerPC cache sets requires a bit more development
  1141. overhead. 
  1142.  
  1143. My advice is to perform all offscreen work using your custom functions and
  1144. then transfer the appropriate update rects to the screen using CopyBits. 
  1145. What you implement should be based on the actual performance you are
  1146. seeing across a test-lab full of machines - preferably representative of
  1147. your customer base.
  1148.  
  1149. > The Windows version of this product will be doing things with a double-
  1150. > buffer, rendering directly to video memory using Windows 95 DirectDraw, and
  1151. > I'd love for the Mac to be able to do something similar.  Anyone have any
  1152. > suggestions or feel like giving me a quick tutorial on Mac video modes?
  1153.  
  1154. Pick up a copy of "Tricks  of the Mac Game Programming Gurus" by
  1155. McCornack, Ragnemalm, Celestin, et al.  - Hayden Books  ISBN:
  1156. 1-56830-183-9
  1157.  
  1158. It provides a fairly complete discussion about hi-performance Macintosh
  1159. game graphics.
  1160. /*------------------------------------------------------
  1161. Chris Arsenault
  1162. Senior Software Engineer
  1163. Roger Wagner Publishing, Inc.   http://www.hyperstudio.com/
  1164. Publishers of HyperStudio
  1165.  
  1166. Opinions and comments expressed are strictly my own.  
  1167. - ----------------------------------------------------*/
  1168.  
  1169. +++++++++++++++++++++++++++
  1170.  
  1171. >From ianm@netgrp.net (Ian McLean)
  1172. Date: 8 Nov 1995 04:04:35 GMT
  1173. Organization: Internet Communications Group
  1174.  
  1175. In article <chrisat-0711951525030001@pslip001.pvd-ri.ids.net>,
  1176. Chris Arsenault <chrisat@ids.net> wrote:
  1177. >
  1178. >My advice is to perform all offscreen work using your custom functions and
  1179. >then transfer the appropriate update rects to the screen using CopyBits. 
  1180. >What you implement should be based on the actual performance you are
  1181. >seeing across a test-lab full of machines - preferably representative of
  1182. >your customer base.
  1183. >
  1184.  
  1185. Chris, this is excellent advice.  Thanks to the information on the
  1186. Mac video subsystems(s) provided by you, David Wareing, Chris De Salvo,
  1187. Jason Regier, Alex Rosenberg, and several others; you've really helped
  1188. me out.  If anyone is interested in this subject, let me know and I'll
  1189. email a concatination of the responses I've received.
  1190.  
  1191. We've recently done exactly what you suggest -- a profiler run on a
  1192. fairly representative distribution of our target platforms.  And the
  1193. basic fact is less than 10% of the CPU is ever spent blitting.  So,
  1194. development time (at least for the game engine) is best spent improving
  1195. the span buffer logic, audio codecs, intersection detection, etc.
  1196.  
  1197. I really can't justify the months of research and coding it would seem
  1198. to take to write a custom page flipping blitter that degrades elegantly
  1199. on older Macs.  At least one person I talked to probably has the
  1200. knowledge to do this; it would be a great project and if you went
  1201. commercial with it I could guarantee at least one customer :-)
  1202.  
  1203.                                         Ian McLean
  1204.  
  1205.  
  1206. ---------------------------
  1207.  
  1208. >From gk1@acpub.duke.edu (Gavin Kistner)
  1209. Subject: Photoshop "CLUT" into 'clut'
  1210. Date: Wed, 01 Nov 1995 01:17:14 -0500
  1211. Organization: Image Refinery Productions, Inc.
  1212.  
  1213. 1) Writing a mac game.  Using custom graphics which start at 24-bits and
  1214. need to be dithered to a custom 8-bits.  Using photoshop to do it, and
  1215. then being unable to make a 'clut' from the info Photoshop creates.  SO...
  1216.  
  1217. After beating my head against walls and looking long and kinda hard for a
  1218. util to do this, I wrote one myself.  If anyone would like the source code
  1219. and/or the small app which reads in a Photoshop pseudo-clut file, creates
  1220. a real CLUT resource from it and sticks that in the resource fork of the
  1221. same file, email me.
  1222.  
  1223. 2) So I've got this great custom clut, I've got my graphic dithered to it,
  1224. saved as a 'PICT', read in, and copied into a window.  I want to be mean
  1225. and nasty and say "Yo Mac, this is *THE* clut to use.  Change all colors
  1226. NOW to *THESE* ones.  Not something close.  THESE ONES!"
  1227. How do I do this?
  1228.  
  1229. TIA,
  1230.  
  1231. - Gavin
  1232. ___________________________________________________________
  1233. Gavin Kistner, aka RabYak, aka !Bob          (919) 613-0877
  1234. <-> Graphics Designer, Image Refinery Productions, Inc. <->
  1235. gk1@acpub.duke.edu       ftp/finger to phrogz.dorm.duke.edu
  1236.  
  1237. +++++++++++++++++++++++++++
  1238.  
  1239. >From pghurh@interaccess.com (PG Hurh)
  1240. Date: 1 Nov 1995 18:48:37 GMT
  1241. Organization: Leaky Faucet & Trailer Hitch
  1242.  
  1243. In article <gk1-0111950117140001@west-111-103.dorm.duke.edu>,
  1244. gk1@acpub.duke.edu (Gavin Kistner) wrote:
  1245.  
  1246. > 1) Writing a mac game.  Using custom graphics which start at 24-bits and
  1247. > need to be dithered to a custom 8-bits.  Using photoshop to do it, and
  1248. > then being unable to make a 'clut' from the info Photoshop creates.  SO...
  1249. > After beating my head against walls and looking long and kinda hard for a
  1250. > util to do this, I wrote one myself.  If anyone would like the source code
  1251. > and/or the small app which reads in a Photoshop pseudo-clut file, creates
  1252. > a real CLUT resource from it and sticks that in the resource fork of the
  1253. > same file, email me.
  1254. > 2) So I've got this great custom clut, I've got my graphic dithered to it,
  1255. > saved as a 'PICT', read in, and copied into a window.  I want to be mean
  1256. > and nasty and say "Yo Mac, this is *THE* clut to use.  Change all colors
  1257. > NOW to *THESE* ones.  Not something close.  THESE ONES!"
  1258. > How do I do this?
  1259.  
  1260. Not a programmer, but I believe you can do these things with deBabelizer
  1261. Toolkit.  I've created custom palettes and attached them to pict files. 
  1262. When I open the pict files in 256 mode the Mac changes the color palette on
  1263. the fly.  
  1264.  
  1265. BTW, palette rotations and the like are described in the ToolBox Assistant
  1266. database (basically Inside Macintosh) available on Apple's developer CD's.
  1267.  
  1268. hope this is somewhat helpful and remotely on topic
  1269.  
  1270. --patrick.
  1271.  
  1272. +++++++++++++++++++++++++++
  1273.  
  1274. >From gk1@acpub.duke.edu (Gavin Kistner)
  1275. Date: Wed, 01 Nov 1995 14:27:12 -0500
  1276. Organization: Image Refinery Productions, Inc.
  1277.  
  1278. After much response I've decided to put this program in all it's hackiness
  1279. online.  I'll not UL it to mac-gifts until it gets much nicer, but for now
  1280. I have it available at 
  1281. ftp://phrogz.dorm.duke.edu//Nails/ULs/Guests/CLUT2clutv0.1.sit
  1282.  
  1283. All suggestions and comments desired and appreciated.
  1284.  
  1285. - Gavin
  1286. ___________________________________________________________
  1287. Gavin Kistner, aka RabYak, aka !Bob          (919) 613-0877
  1288. <-> Graphics Designer, Image Refinery Productions, Inc. <->
  1289. gk1@acpub.duke.edu       ftp/finger to phrogz.dorm.duke.edu
  1290.  
  1291. +++++++++++++++++++++++++++
  1292.  
  1293. >From hunt@scws23.harvard.edu (Timothy Hunt)
  1294. Date: 1 Nov 1995 19:21:20 GMT
  1295. Organization: Harvard University, Cambridge, Massachusetts
  1296.  
  1297. Gavin Kistner (gk1@acpub.duke.edu) wrote:
  1298. : [deleted]
  1299. : 2) So I've got this great custom clut, I've got my graphic dithered to it,
  1300. : saved as a 'PICT', read in, and copied into a window.  I want to be mean
  1301. : and nasty and say "Yo Mac, this is *THE* clut to use.  Change all colors
  1302. : NOW to *THESE* ones.  Not something close.  THESE ONES!"
  1303. : How do I do this?
  1304. I use SetEntries() which should be documented in IM quickdraw chapters
  1305. I'm not sure this is exactly it, but I think:
  1306.   SetEntries(-1,(*myClut)->ctSize,(*myClut)->ctTable);
  1307. should do the trick if 'myClut' is a clut handle.  I don't remember the 
  1308. exact details, but there are times when you might need to fill in the
  1309. .ctTable[].value field for SetEntries to work.  I think that's only if you
  1310. start with a copy of the current device's clut.
  1311.  
  1312. This is not the method of changing a clut that's the most friendly to the
  1313. rest of the system and other apps, but it's simple and gives you the exact 
  1314. results you asked for.  Anyone want to offer alternatives with the Palette
  1315. Manager?  Does anyone use the Palette manager?
  1316. : TIA,
  1317.  
  1318. : - Gavin
  1319. : ___________________________________________________________
  1320. : Gavin Kistner, aka RabYak, aka !Bob          (919) 613-0877
  1321. : <-> Graphics Designer, Image Refinery Productions, Inc. <->
  1322. : gk1@acpub.duke.edu       ftp/finger to phrogz.dorm.duke.edu
  1323.  
  1324. +++++++++++++++++++++++++++
  1325.  
  1326. >From lhender@utdallas.edu (Lee Henderson)
  1327. Date: Wed, 01 Nov 1995 14:41:20 -0600
  1328. Organization: University of Texas at Dallas
  1329.  
  1330. In article <gk1-0111950117140001@west-111-103.dorm.duke.edu>,
  1331. gk1@acpub.duke.edu (Gavin Kistner) wrote:
  1332.  
  1333. >1) Writing a mac game.  Using custom graphics which start at 24-bits and
  1334. >need to be dithered to a custom 8-bits.  Using photoshop to do it, and
  1335. >then being unable to make a 'clut' from the info Photoshop creates.  SO...
  1336. >
  1337. >After beating my head against walls and looking long and kinda hard for a
  1338. >util to do this, I wrote one myself.  If anyone would like the source code
  1339. >and/or the small app which reads in a Photoshop pseudo-clut file, creates
  1340. >a real CLUT resource from it and sticks that in the resource fork of the
  1341. >same file, email me.
  1342. >
  1343. >2) So I've got this great custom clut, I've got my graphic dithered to it,
  1344. >saved as a 'PICT', read in, and copied into a window.  I want to be mean
  1345. >and nasty and say "Yo Mac, this is *THE* clut to use.  Change all colors
  1346. >NOW to *THESE* ones.  Not something close.  THESE ONES!"
  1347. >How do I do this?
  1348. >
  1349. I believe you can force ResEdit to do this.  I have never tried it with PICT's
  1350.  but I have done it with icl8 etc.  Try putting the clut resource in the same 
  1351. resource file and then create a new PICT, choose your custom clut and load
  1352. in (possibly thru clipboard?) the PICT.  If the positions of your clut colors 
  1353. are close to the colors that the clipboard uses, this may work.  Perhaps one
  1354. of those PICT to rsrc single function converter things would do it too.
  1355.  
  1356. Lee Henderson
  1357.  
  1358. +++++++++++++++++++++++++++
  1359.  
  1360. >From gherrick@umich.edu
  1361. Date: Wed, 01 Nov 1995 23:18:13 -0500
  1362. Organization: University of Michigan
  1363.  
  1364. In article <gk1-0111950117140001@west-111-103.dorm.duke.edu>,
  1365. gk1@acpub.duke.edu (Gavin Kistner) wrote:
  1366.  
  1367. > 1) Writing a mac game.  Using custom graphics which start at 24-bits and
  1368. > need to be dithered to a custom 8-bits.  Using photoshop to do it, and
  1369. > then being unable to make a 'clut' from the info Photoshop creates.  SO...
  1370. > After beating my head against walls and looking long and kinda hard for a
  1371. > util to do this, I wrote one myself.  If anyone would like the source code
  1372. > and/or the small app which reads in a Photoshop pseudo-clut file, creates
  1373. > a real CLUT resource from it and sticks that in the resource fork of the
  1374. > same file, email me.
  1375.  
  1376. I did the same thing a few months ago!
  1377. I actually have two programs:  one does clut to CLUT and the other does it
  1378. the other way 'round.
  1379.  
  1380. I wonder how many other people have little personal utilities like this? 
  1381. I also have a little one I made a while back that just takes two PICTs and
  1382. splices them together, one on top of the other.
  1383.  
  1384. Here's the one that converts CLUTs to cluts:
  1385. (it may not be too elegant but it does the job)
  1386.  
  1387. /*** CTab to clut ***/
  1388. typedef struct OldValues
  1389. {
  1390.    unsigned char oldRed;
  1391.    unsigned char oldGreen;
  1392.    unsigned char oldBlue;
  1393. } OldValues;
  1394.  
  1395. typedef struct NewValues
  1396. {
  1397.    unsigned short newRed;
  1398.    unsigned short newGreen;
  1399.    unsigned short newBlue;
  1400. } NewValues;
  1401.  
  1402. void ToolBoxInit(void);
  1403. void DoTheThing(FSSpec theSpec);
  1404. Handle ProcessTheData(Handle data, long size);
  1405. NewValues ComputeNewValue(OldValues theOld);
  1406.  
  1407. void main(void)
  1408. {
  1409.    StandardFileReply reply;
  1410.    SFTypeList list;
  1411.    FSSpec theSpec;
  1412.    
  1413.    ToolBoxInit();
  1414.    list[0] = '8BCT';
  1415.    StandardGetFile(nil,1,list,&reply);
  1416.    if (reply.sfGood) DoTheThing(reply.sfFile);
  1417. }
  1418.  
  1419. void ToolBoxInit(void)
  1420. {
  1421.    InitGraf(&thePort);
  1422.    InitFonts();
  1423.    InitWindows();
  1424.    InitMenus();
  1425.    TEInit();
  1426.    InitDialogs(nil);
  1427.    InitCursor();
  1428. }
  1429.  
  1430. void DoTheThing(FSSpec theSpec)
  1431. {
  1432.    short fref;
  1433.    OSErr myErr;
  1434.    Handle myData, newData;
  1435.    long eof, theSize;
  1436.    short numCluts;
  1437.    
  1438.    if (myErr = FSpOpenDF(&theSpec,fsRdWrPerm,&fref)) {SysBeep(5);return;}
  1439.    if (myErr = GetEOF(fref,&eof)) {SysBeep(5);return;}
  1440.    theSize = eof;
  1441.    myData = NewHandle((Size)theSize);
  1442.    HLock(myData);
  1443.    if ((myErr = FSRead(fref,&eof,*myData))!=eofErr && myErr)
  1444. {SysBeep(5);return;}
  1445.    HUnlock(myData);
  1446.    if (myErr = FSClose(fref)) {SysBeep(5);return;}
  1447.    newData = ProcessTheData(myData,theSize);
  1448.    numCluts = CountResources('clut');
  1449.    AddResource(newData,'clut',128+numCluts,theSpec.name);
  1450.    DisposeHandle(myData);
  1451. }
  1452.  
  1453. Handle ProcessTheData(Handle data, long size)
  1454. {
  1455.    long newSize;
  1456.    Handle newHandle;
  1457.    Ptr dataPtr, bufPtr;
  1458.    short numColors, count;
  1459.    unsigned char theValue;
  1460.    unsigned short newValue;
  1461.    Boolean OneBlack = false;
  1462.    Boolean TwoBlack = false;
  1463.    OldValues theOld;
  1464.    NewValues theNew;
  1465.    
  1466.    numColors = size/3;
  1467.    newSize = numColors*8+8;
  1468.    newHandle = NewHandleClear((Size)newSize);
  1469.    HLock(newHandle);
  1470.    HLock(data);
  1471.    dataPtr = *data;
  1472.    bufPtr = *newHandle;
  1473.    
  1474.    *((short *)bufPtr) = 0;    /* this and the next one are the CtSeed field */
  1475.    bufPtr += sizeof(short);
  1476.    *((short *)bufPtr) = 0;
  1477.    bufPtr += sizeof(short);
  1478.    *((short *)bufPtr) = 0;    /* this is the CtFlags field */
  1479.    bufPtr += sizeof(short);
  1480.    *((short *)bufPtr) = numColors-1;    /* this should actually be the
  1481. real number of colors */
  1482.    bufPtr += sizeof(short);
  1483.    count = numColors;
  1484.    while(count--)
  1485.    {
  1486.       theOld = *((OldValues *)dataPtr);
  1487.       dataPtr += 3L;   /*sizeof(OldValues);*/
  1488.       if (!(theOld.oldRed||theOld.oldGreen||theOld.oldBlue))
  1489.       {
  1490.          if (OneBlack)
  1491.          {
  1492.             TwoBlack = true;
  1493.             break;
  1494.          }
  1495.          else OneBlack = true;
  1496.       }
  1497.       *((short *)bufPtr) = numColors-1-count;
  1498.       bufPtr += sizeof(short);
  1499.       theNew = ComputeNewValue(theOld);
  1500.       *((NewValues *)bufPtr) = theNew;
  1501.       bufPtr += sizeof(NewValues);     
  1502.    }
  1503.    HUnlock(data);
  1504.    HUnlock(newHandle);
  1505.    if (TwoBlack)
  1506.    {
  1507.       newSize = (numColors-1-count)*8+8;
  1508.       SetHandleSize(newHandle,(Size)newSize);
  1509.       HLock(newHandle);
  1510.       bufPtr = *newHandle;
  1511.       bufPtr += (sizeof(long)+sizeof(short));
  1512.       *((unsigned short *)bufPtr) = numColors-count-2;
  1513.       HUnlock(newHandle);
  1514.    }
  1515.    return(newHandle);
  1516. }
  1517.  
  1518. NewValues ComputeNewValue(OldValues theOld)
  1519. {
  1520.    NewValues theNew;
  1521.    
  1522.    theNew.newRed = (unsigned short)(257*(unsigned short)theOld.oldRed);
  1523.    theNew.newGreen = (unsigned short)(257*(unsigned short)theOld.oldGreen);
  1524.    theNew.newBlue = (unsigned short)(257*(unsigned short)theOld.oldBlue);
  1525.    return theNew;
  1526. }
  1527.  
  1528. +++++++++++++++++++++++++++
  1529.  
  1530. >From mick@emf.net (Mick Foley)
  1531. Date: Wed, 01 Nov 1995 22:50:35 -0800
  1532. Organization: "emf.net" Quality Internet Access.  (510) 704-2929 (Voice)
  1533.  
  1534. In article <478hbg$dfh@decaxp.harvard.edu>, hunt@scws23.harvard.edu
  1535. (Timothy Hunt) wrote:
  1536.  
  1537. > I use SetEntries() which should be documented in IM quickdraw chapters
  1538. > I'm not sure this is exactly it, but I think:
  1539. >   SetEntries(-1,(*myClut)->ctSize,(*myClut)->ctTable);
  1540. > should do the trick if 'myClut' is a clut handle.  I don't remember the 
  1541. > exact details, but there are times when you might need to fill in the
  1542. > .ctTable[].value field for SetEntries to work.  I think that's only if you
  1543. > start with a copy of the current device's clut.
  1544. > This is not the method of changing a clut that's the most friendly to the
  1545. > rest of the system and other apps, but it's simple and gives you the exact 
  1546. > results you asked for.  Anyone want to offer alternatives with the Palette
  1547. > Manager?  Does anyone use the Palette manager?
  1548. > : TIA,
  1549. > : - Gavin
  1550.  
  1551. Believe it or not, I use the Palette manager, as screwed up as it is.
  1552.  
  1553. Here is what I do:
  1554.  
  1555.    CTabHandle theClut;     // the color table we will use to build the palette
  1556.    PaletteHandle gamePalette
  1557.  
  1558.    // Get the color table
  1559.    theClut = GetCTable( clut_GameDefaultColorTable );
  1560.    
  1561.    // build a palette
  1562.    mGamePalette = NewPalette( 256, theClut, pmExplicit | pmTolerant, 0 );
  1563.    SetPalette( ( WindowPtr )-1L, mGamePalette, true );
  1564.    
  1565.    // Dump the color table
  1566.    DisposeCTable( theClut );
  1567.  
  1568. The call to SetPalette makes the palette the "application palette" -- the
  1569. palette for all the windows without their own palette. The pmExplicit |
  1570. pmTolerant usage make sure that I will get the colors I want where I want
  1571. them. The disadvantage is that the application palette requires system 7
  1572. and the usage requires 32 color quickdraw.
  1573.  
  1574. Mick
  1575.  
  1576. +++++++++++++++++++++++++++
  1577.  
  1578. >From clements@lit.princeton.edu (John B. Clements)
  1579. Date: 2 Nov 1995 01:37:28 GMT
  1580. Organization: Princeton University
  1581.  
  1582. In article <478hbg$dfh@decaxp.harvard.edu>,
  1583. Timothy Hunt <hunt@scws23.harvard.edu> wrote:
  1584. >Gavin Kistner (gk1@acpub.duke.edu) wrote:
  1585. >: [deleted]
  1586. >: 2) So I've got this great custom clut, I've got my graphic dithered to it,
  1587. >: saved as a 'PICT', read in, and copied into a window.  I want to be mean
  1588. >: and nasty and say "Yo Mac, this is *THE* clut to use.  Change all colors
  1589. >: NOW to *THESE* ones.  Not something close.  THESE ONES!"
  1590. >: How do I do this?
  1591. >
  1592. >...
  1593. >
  1594. >This is not the method of changing a clut that's the most friendly to the
  1595. >rest of the system and other apps, but it's simple and gives you the exact 
  1596. >results you asked for.  Anyone want to offer alternatives with the Palette
  1597. >Manager?  Does anyone use the Palette manager?
  1598.  
  1599. yup, I do.  Now granted, I don't have a need for truly blazing speed, and
  1600. I haven't had access to Nifty Game Tricks books (tho' I'll probably buy
  1601. that one soon), so my techniques may not be the best available, but they
  1602. _are_ fairly kind to the rest of the system.
  1603.  
  1604. Note: this assumes you're using a GWorld for the offscreen picture.
  1605.  
  1606. If you turn that 'clut' into a 'pltt' resource (not too diff., mail me if you
  1607. want details), you can associate that with the onscreen window, and then
  1608. copy the pltt into a clut (standard routines from Palette Manager), and 
  1609. _then_ (this is the tricky bit) set bit 14 of the ctFlags element in the clut
  1610. structure, then copybits will omit the color translation stage and simply use
  1611. the same pixel values, ignoring the mapping from color to color.  Since the 
  1612. PICT was drawn with a clut that is identical to the pltt, there's no need for
  1613. this extra stage and copybits won't mess up your values.
  1614.  
  1615. Hope this has something to do w/ your question,
  1616.  
  1617. john
  1618.  
  1619.  
  1620. +++++++++++++++++++++++++++
  1621.  
  1622. >From catambay@aol.com (Bill the Cat)
  1623. Date: Thu, 02 Nov 1995 07:14:33 -0700
  1624. Organization: MacPascal Mailing List
  1625.  
  1626. In article <gk1-0111950117140001@west-111-103.dorm.duke.edu>,
  1627. gk1@acpub.duke.edu (Gavin Kistner) wrote:
  1628.  
  1629. > 1) Writing a mac game.  Using custom graphics which start at 24-bits and
  1630. > need to be dithered to a custom 8-bits.  Using photoshop to do it, and
  1631. > then being unable to make a 'clut' from the info Photoshop creates.  SO...
  1632. > After beating my head against walls and looking long and kinda hard for a
  1633. > util to do this, I wrote one myself.  If anyone would like the source code
  1634. > and/or the small app which reads in a Photoshop pseudo-clut file, creates
  1635. > a real CLUT resource from it and sticks that in the resource fork of the
  1636. > same file, email me.
  1637.  
  1638. Yes!  I am very much interested in this, and if you could email me the
  1639. source code and information related to it, I would be forever grateful. 
  1640. =)
  1641.  
  1642. I am always struggling to take a 24 bit or 32 bit image and make it 8-bit
  1643. and _still_ look decent.  So far I have not been successful, so if you
  1644. could provide me any information which may help me, a hundred thanks in
  1645. advance!
  1646.  
  1647. _____________________________________________________________________
  1648. Bill Catambay
  1649. Pascal Programmer on Macintosh and Open VMS
  1650.  
  1651.               />
  1652.              //   The purpose of software engineering  
  1653.      (//////[O]>=========================================-
  1654.              \\    is to manage complexity, not to create it.
  1655.               \>
  1656.  
  1657. ____________________________________________________________________
  1658.         
  1659.  
  1660. +++++++++++++++++++++++++++
  1661.  
  1662. >From meggs@virginia.edu (Andrew Meggs)
  1663. Date: Fri, 3 Nov 1995 15:39:48 GMT
  1664. Organization: University of Virginia
  1665.  
  1666. In article <gherrick-0111952318130001@pm047-28.dialip.mich.net>,
  1667. gherrick@umich.edu wrote:
  1668.  
  1669. > I did the same thing a few months ago!
  1670. > I actually have two programs:  one does clut to CLUT and the other does it
  1671. > the other way 'round.
  1672. > I wonder how many other people have little personal utilities like this? 
  1673.  
  1674. Probably everyone. I spent about two months writing tools (including a
  1675. CLUT-->clut tool :)) before I was able to write actual game code.
  1676.  
  1677. > I also have a little one I made a while back that just takes two PICTs and
  1678. > splices them together, one on top of the other.
  1679.  
  1680. I've got that one too. And one that takes two 4-bit PICTS and merges
  1681. them into one 8-bit that can fade between the two by palette animation.
  1682. And one that takes a rendering with an alpha channel and splits it into
  1683. a sprite and a mask. And everything else under the sun.
  1684.  
  1685. If we were nice people who weren't competing with each other in a
  1686. cutthroat segment of the software market, it would be nice if we
  1687. could share these things.
  1688.  
  1689. Speaking of sharing code, I should probably put a plug in here for
  1690. my 3D graphics library. Everyone go look at
  1691.   <http://darwin.clas.virginia.edu/~apm3g/deadtv/cabala/index.html>
  1692. and discover what texture-mapping speed is.
  1693.  
  1694. -- 
  1695. _________________________________________________________________________
  1696. andrew meggs                                 people who sleep really suck
  1697. meggs@virginia.edu                http://darwin.clas.virginia.edu/~apm3g/
  1698.  
  1699. +++++++++++++++++++++++++++
  1700.  
  1701. >From danker@hardy.ocs.mq.edu.au (Duncan Anker)
  1702. Date: 6 Nov 1995 01:18:36 GMT
  1703. Organization: Macquarie University
  1704.  
  1705. Gavin Kistner (gk1@acpub.duke.edu) wrote:
  1706. : 1) Writing a mac game.  Using custom graphics which start at 24-bits and
  1707. : need to be dithered to a custom 8-bits.  Using photoshop to do it, and
  1708. : then being unable to make a 'clut' from the info Photoshop creates.  SO...
  1709.  
  1710. : After beating my head against walls and looking long and kinda hard for a
  1711. : util to do this, I wrote one myself.  If anyone would like the source code
  1712. : and/or the small app which reads in a Photoshop pseudo-clut file, creates
  1713. : a real CLUT resource from it and sticks that in the resource fork of the
  1714. : same file, email me.
  1715.  
  1716. Why couldn't you save your 8-bit graphics as a pict file? Doesn't Photoshop
  1717. whack the CLUT in as a resource? Just a thought.
  1718.  
  1719. : 2) So I've got this great custom clut, I've got my graphic dithered to it,
  1720. : saved as a 'PICT', read in, and copied into a window.  I want to be mean
  1721. : and nasty and say "Yo Mac, this is *THE* clut to use.  Change all colors
  1722. : NOW to *THESE* ones.  Not something close.  THESE ONES!"
  1723. : How do I do this?
  1724.  
  1725. Well, you need the speech manager...
  1726.  
  1727. Seriously, though, maybe you should look at using the palette manager, rather
  1728. than mucking around with cluts directly. This allows you to set explicit,
  1729. or animated or whatever.
  1730.  
  1731. Unfortunately I have no references on hand, so I'll leave an expert to
  1732. answer your questions more specifically.
  1733.  
  1734. --
  1735. mailto:danker@hardy.ocs.mq.edu.au        http://hardy.ocs.mq.edu.au/~danker/
  1736.  
  1737.  Live pure, right wrong, and follow behind the king. Else wherefore born?
  1738.  
  1739. +++++++++++++++++++++++++++
  1740.  
  1741. >From meggs@virginia.edu (Andrew Meggs)
  1742. Date: Mon, 6 Nov 1995 16:02:44 GMT
  1743. Organization: University of Virginia
  1744.  
  1745. In article <pghurh-011195124320@hurh.fnal.gov>, pghurh@interaccess.com (PG
  1746. Hurh) wrote:
  1747. > In article <gk1-0111950117140001@west-111-103.dorm.duke.edu>,
  1748. > gk1@acpub.duke.edu (Gavin Kistner) wrote:
  1749. > > 1) Writing a mac game.  Using custom graphics which start at 24-bits and
  1750. > > need to be dithered to a custom 8-bits.  Using photoshop to do it, and
  1751. > > then being unable to make a 'clut' from the info Photoshop creates.  SO...
  1752. > > 
  1753. > > After beating my head against walls and looking long and kinda hard for a
  1754. > > util to do this, I wrote one myself.  If anyone would like the source code
  1755. > > and/or the small app which reads in a Photoshop pseudo-clut file, creates
  1756. > > a real CLUT resource from it and sticks that in the resource fork of the
  1757. > > same file, email me.
  1758. > > 
  1759. > > 2) So I've got this great custom clut, I've got my graphic dithered to it,
  1760. > > saved as a 'PICT', read in, and copied into a window.  I want to be mean
  1761. > > and nasty and say "Yo Mac, this is *THE* clut to use.  Change all colors
  1762. > > NOW to *THESE* ones.  Not something close.  THESE ONES!"
  1763. > > How do I do this?
  1764.  
  1765. You want the SetEntries call. As in,
  1766.  
  1767. CTabHandle my_clut = GetMyCLUTSomehow();
  1768.  
  1769. SetEntries( 0, 255, (**my_clut).ctTable );
  1770.  
  1771.  
  1772.  
  1773. > Not a programmer, but I believe you can do these things with deBabelizer
  1774. > Toolkit.  I've created custom palettes and attached them to pict files. 
  1775. > When I open the pict files in 256 mode the Mac changes the color palette on
  1776. > the fly.  
  1777.  
  1778. As far as I know, a PICT (hopefully) can't alter your environment just
  1779. by being drawn. Most likely, the apps are getting information that's been
  1780. encoded with the PICT or by using the Picture Utilities, and then setting
  1781. the palette themselves before drawing the PICT.
  1782.  
  1783. -- 
  1784. _________________________________________________________________________
  1785. andrew meggs                                 people who sleep really suck
  1786. meggs@virginia.edu                http://darwin.clas.virginia.edu/~apm3g/
  1787.  
  1788. +++++++++++++++++++++++++++
  1789.  
  1790. >From gk1@acpub.duke.edu (Gavin Kistner)
  1791. Date: Tue, 07 Nov 1995 04:51:42 -0500
  1792. Organization: Image Refinery Productions, Inc.
  1793.  
  1794. In article <47jnpc$i99@sunb.ocs.mq.edu.au>, danker@hardy.ocs.mq.edu.au
  1795. (Duncan Anker) wrote:
  1796.  
  1797. >Why couldn't you save your 8-bit graphics as a pict file? Doesn't Photoshop
  1798. >whack the CLUT in as a resource? Just a thought.
  1799.  
  1800. Nope, it doesn't.
  1801.  
  1802.  
  1803. >: 2) So I've got this great custom clut, I've got my graphic dithered to it,
  1804. >: saved as a 'PICT', read in, and copied into a window.  I want to be mean
  1805. >: and nasty and say "Yo Mac, this is *THE* clut to use.  Change all colors
  1806. >: NOW to *THESE* ones.  Not something close.  THESE ONES!"
  1807. >: How do I do this?
  1808.  
  1809. Regarding everyone's advice on this question of mine:  Thanks, everyone
  1810. seems to be saying the same thing, but it doesn't seem to be working.  I
  1811. think perhaps I have one pict saved with one CLUT and am using another,
  1812. because my monitor is certainly going to funky colors, but the final
  1813. result of the drawn picture is not at all correct.  When I've tested more
  1814. I'll ask for more help on this.  Thanks again.
  1815.  
  1816. - Gavin
  1817. ___________________________________________________________
  1818. Gavin Kistner, aka RabYak, aka !Bob          (919) 613-0877
  1819. <-> Graphics Designer, Image Refinery Productions, Inc. <->
  1820. gk1@acpub.duke.edu       ftp/finger to phrogz.dorm.duke.edu
  1821.  
  1822. +++++++++++++++++++++++++++
  1823.  
  1824. >From mick@emf.net (Mick Foley)
  1825. Date: Mon, 06 Nov 1995 22:33:36 -0800
  1826. Organization: "emf.net" Quality Internet Access.  (510) 704-2929 (Voice)
  1827.  
  1828. > You want the SetEntries call. As in,
  1829. > CTabHandle my_clut = GetMyCLUTSomehow();
  1830. > SetEntries( 0, 255, (**my_clut).ctTable );
  1831.  
  1832. If at all possible, use the palette manager to set the color environment
  1833. -- it causes less side effects. (Believe me, I have done it both ways).
  1834. Here is the code I use to set the colors for the application:
  1835.  
  1836.    CTabHandle theClut;   // the color table we will use to build the palette
  1837.    // Get the color table
  1838.    theClut = GetCTable( kColorTableID );
  1839.    
  1840.    // build a palette
  1841.    thePalette = NewPalette( 256, theClut, pmExplicit | pmTolerant, 0 );
  1842.    SetPalette( ( WindowPtr )-1L,thePalette, true );
  1843.    
  1844.    // Dump the color table
  1845.    ::DisposeCTable( theClut );
  1846.  
  1847. This will have the same effect as the set entries calls and is much cleaner.
  1848.  
  1849. Enjoy --
  1850.  
  1851. Mick
  1852.  
  1853. +++++++++++++++++++++++++++
  1854.  
  1855. >From tesuji@xs4all.nl (Mark Boon)
  1856. Date: Wed, 08 Nov 1995 17:45:31 +0100
  1857. Organization: Tesuji Software B.V.
  1858.  
  1859. In article <gk1-0711950451420001@west-111-103.dorm.duke.edu>,
  1860. gk1@acpub.duke.edu (Gavin Kistner) wrote:
  1861.  
  1862. > In article <47jnpc$i99@sunb.ocs.mq.edu.au>, danker@hardy.ocs.mq.edu.au
  1863. > (Duncan Anker) wrote:
  1864. > >Why couldn't you save your 8-bit graphics as a pict file? Doesn't Photoshop
  1865. > >whack the CLUT in as a resource? Just a thought.
  1866. > Nope, it doesn't.
  1867.  
  1868. I've struggled a lot with this too. One solution is to use Debabelizer.
  1869. You can read in a Photoshop file and save it together with its CLUT.
  1870.  
  1871. Still, it won't guarantee your colors will come out right. Using
  1872. CopyDeepMask or so still often gives a dithered image for no apparent
  1873. reason. The system seems to think that a color, filtered through 100%
  1874. transparent is not the same as the original color, so it picks another
  1875. color that looks like it.
  1876.  
  1877. -- 
  1878. Mark Boon
  1879.  
  1880. Tesuji Software B.V.
  1881.  
  1882. ---------------------------
  1883.  
  1884. >From David Reiss <reiss@astro.washington.edu>
  1885. Subject: Question: Best format for saving region data?
  1886. Date: 3 Nov 1995 04:03:54 GMT
  1887. Organization: http://www.astro.washington.edu
  1888.  
  1889. Hi.  This is a question I've been killing myself over for months and
  1890. still haven't settled on an answer.  I'm writing a board game which
  1891. has blob-shaped regions as board spaces.  I want to use them as
  1892. regions in my game, so that they support drag-and-drop, hiliting,
  1893. etc.  My question is this: how do I set up the application to store
  1894. the info on these regions (e.g. in a resource, or in the data fork)?
  1895. I've played with these options:
  1896.  
  1897. 1. saving regions to a resource.  I'm warned that this is bad since 
  1898. the format of regions may change in the future.
  1899. 2. saving picts of the regions and using BitmapToRegion() to convert
  1900. these to regions at run-time.  This will be slow and a pain in the butt
  1901. to implement.
  1902. 3. Do the same as (2) but use icons (can you make icons bigger than
  1903. 32x32 pixels?) and use IconToRgn() (or whatever it's called) to get the
  1904. region. Disadvantage: how do you write a region into an icon resource?
  1905. 4. Saving one picture of the board in a resource and a bunch of points
  1906. in resources to use as seeds for BitmapToRegion().  This is similar to
  1907. (2) but could be easier and faster.
  1908. 5. Somehow create the regions (eg from lines and/or rects) at runtime.
  1909. This is a pain because I have to represent each of my blobs as a sum
  1910. of geometrical shapes.
  1911.  
  1912. There are probably others.  I'd love to  hear any recommendations/
  1913. experiences from all of you great game programmers.  Thanks a lot!
  1914.  
  1915. -David
  1916.  
  1917.  
  1918. +++++++++++++++++++++++++++
  1919.  
  1920. >From ingemar@lysator.liu.se (Ingemar Ragnemalm)
  1921. Date: 3 Nov 1995 09:59:25 GMT
  1922. Organization: (none)
  1923.  
  1924. David Reiss <reiss@astro.washington.edu> writes:
  1925.  
  1926. >Hi.  This is a question I've been killing myself over for months and
  1927. >still haven't settled on an answer.  I'm writing a board game which
  1928. >has blob-shaped regions as board spaces.  I want to use them as
  1929. >regions in my game, so that they support drag-and-drop, hiliting,
  1930. >etc.  My question is this: how do I set up the application to store
  1931. >the info on these regions (e.g. in a resource, or in the data fork)?
  1932. >I've played with these options:
  1933.  
  1934. >1. saving regions to a resource.  I'm warned that this is bad since 
  1935. >the format of regions may change in the future.
  1936.  
  1937. This is what I do in the jigsaw game Christmas'95 (coming very soon).
  1938. Of course, I run less risk than you since I only save regions for the
  1939. "save game" feature, not for permanent data.
  1940.  
  1941. >2. saving picts of the regions and using BitmapToRegion() to convert
  1942. >these to regions at run-time.  This will be slow and a pain in the butt
  1943. >to implement.
  1944.  
  1945. Not that slow, if you use B/W PICTs and B/W offscreens, and not hard to
  1946. implement at all. A good choice.
  1947.  
  1948. >3. Do the same as (2) but use icons (can you make icons bigger than
  1949. >32x32 pixels?) and use IconToRgn() (or whatever it's called) to get the
  1950. >region. Disadvantage: how do you write a region into an icon resource?
  1951.  
  1952. Is there a standard icon-to-region call? I guess I never noticed it.
  1953. Looks like a kludge to me that will be limited. "cicn" icons can be as big
  1954. as 64x64, but other icons are limited to 32x32.
  1955.  
  1956. >4. Saving one picture of the board in a resource and a bunch of points
  1957. >in resources to use as seeds for BitmapToRegion().  This is similar to
  1958. >(2) but could be easier and faster.
  1959.  
  1960. Much harder to implement, with the seeds an all.
  1961.  
  1962. >5. Somehow create the regions (eg from lines and/or rects) at runtime.
  1963. >This is a pain because I have to represent each of my blobs as a sum
  1964. >of geometrical shapes.
  1965.  
  1966. Don't.
  1967.  
  1968. >There are probably others.  I'd love to  hear any recommendations/
  1969. >experiences from all of you great game programmers.  Thanks a lot!
  1970.  
  1971. One more is to define the shapes as polygons, which you can draw in some
  1972. drawing program which will give you plenty of freedom. You can then extract
  1973. the polygons from a picture that defines the whole layout... but it will
  1974. be more work than some of the methods above.
  1975.  
  1976.  
  1977.  
  1978. --
  1979. - -
  1980. Ingemar Ragnemalm, PhD
  1981. Image processing, Mac shareware games
  1982. E-mail address: ingemar@isy.liu.se or ingemar@lysator.liu.se
  1983.  
  1984. +++++++++++++++++++++++++++
  1985.  
  1986. >From Shapiro@AOL.com (Eric Shapiro)
  1987. Date: Mon, 06 Nov 1995 18:48:39 -0500
  1988. Organization: Rock Ridge Enterprises
  1989.  
  1990. In article <47c4ba$54b@nntp5.u.washington.edu>, David Reiss
  1991. <reiss@astro.washington.edu> wrote:
  1992.  
  1993. > Hi.  This is a question I've been killing myself over for months and
  1994. > still haven't settled on an answer.  I'm writing a board game which
  1995. > has blob-shaped regions as board spaces.  I want to use them as
  1996. > regions in my game, so that they support drag-and-drop, hiliting,
  1997. > etc.  My question is this: how do I set up the application to store
  1998. > the info on these regions (e.g. in a resource, or in the data fork)?
  1999. > I've played with these options:
  2000.  
  2001. You can either:
  2002.  
  2003.   (1) Use regions since the format won't likely change, especially
  2004.       before Copland and then you'll probably have to update your
  2005.       code anyway.
  2006.  
  2007.   (2) Use polygons as the permanent storage format
  2008.   
  2009. Saving polygons on disk is not a bad idea because they can easily
  2010. be converted into regions at runtime using OpenRgn & DrawPoly.
  2011.  
  2012. If you want some sample code that converts regions into polygons,
  2013. check out the OpenDoc CD-ROM. They use polygons instead of regions
  2014. and have conversion routines as well. The reason they use polygons
  2015. is that the region structure is patented (or a trade secret anyway)
  2016. and Apple didn't want to publicly discuss the structure.
  2017.  
  2018. To convert regions to polygons they draw the polygon into a bitmap
  2019. and then scan the bitmap for the edges.
  2020.  
  2021.  -Eric Shapiro
  2022.  
  2023. -- 
  2024. Eric Shapiro
  2025. Rock Ridge Enterprises
  2026. shapiro@aol.com
  2027.  
  2028. ---------------------------
  2029.  
  2030. >From timmyd@netcom.com (Tim DeBenedictis)
  2031. Subject: Serial baud rates > 57.6KBaud?
  2032. Date: Tue, 7 Nov 1995 00:18:48 GMT
  2033. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  2034.  
  2035. How do I get serial communications rates greater than 57.6KBaud?  It's 
  2036. not in the FAQ, and documentation for SerReset() contains nothing higher 
  2037. than 57.6 KBaud in either THINK Reference or in MPTA.  Please, no vague 
  2038. answers like "Use the Communications Toolbox"!  I need a specific Toolbox 
  2039. routine or a specific place to look in the Universal Headers; source code 
  2040. would be ideal.
  2041.  
  2042. Thanks,
  2043.  
  2044. -Tim DeBenedictis
  2045. timmyd@netcom.com
  2046.  
  2047.  
  2048. +++++++++++++++++++++++++++
  2049.  
  2050. >From cardona@tradewave.com (Richard Cardona)
  2051. Date: Tue, 07 Nov 1995 10:17:54 -0600
  2052. Organization: TradeWave Corp.
  2053.  
  2054. In article <timmydDHnCvC.CDq@netcom.com>, timmyd@netcom.com (Tim
  2055. DeBenedictis) wrote:
  2056.  
  2057. > How do I get serial communications rates greater than 57.6KBaud?  It's 
  2058. > not in the FAQ, and documentation for SerReset() contains nothing higher 
  2059. > than 57.6 KBaud in either THINK Reference or in MPTA.  Please, no vague 
  2060. > answers like "Use the Communications Toolbox"!  I need a specific Toolbox 
  2061. > routine or a specific place to look in the Universal Headers; source code 
  2062. > would be ideal.
  2063. > Thanks,
  2064. > -Tim DeBenedictis
  2065. > timmyd@netcom.com
  2066.  
  2067. The simple answer is that there is no Apple-documented way of going over
  2068. 57.6k on the serial ports.
  2069.  
  2070. The harder answer is that there are controls calls you can make to put the
  2071. SerialDMA driver into 230.4k mode, but not 115.2k.  According to David
  2072. Schwarz (author of SerialSpeed 230) you must write to the Serial
  2073. Controller Chip (SCC) directly to achieve 115.2k.
  2074.  
  2075. Guess the full potential range of the serial ports will not be available
  2076. until Copland?  I though OpenTransport would also provide some serial
  2077. support, does anyone know if a future OT will provide higher rates?
  2078.  
  2079. Rick
  2080.  
  2081. +++++++++++++++++++++++++++
  2082.  
  2083. >From Tom Smith <tom_smith@moldev.com>
  2084. Date: Thu, 09 Nov 1995 16:47:26 -0800
  2085. Organization: Best Internet Communications
  2086.  
  2087. Richard Cardona wrote:
  2088. > In article <timmydDHnCvC.CDq@netcom.com>, timmyd@netcom.com (Tim
  2089. > DeBenedictis) wrote:
  2090. > > How do I get serial communications rates greater than 57.6KBaud?  It's
  2091. > > not in the FAQ, and documentation for SerReset() contains nothing higher
  2092. > > than 57.6 KBaud in either THINK Reference or in MPTA.  Please, no vague
  2093. > > answers like "Use the Communications Toolbox"!  I need a specific Toolbox
  2094. > > routine or a specific place to look in the Universal Headers; source code
  2095. > > would be ideal.
  2096. > >
  2097. > > Thanks,
  2098. > >
  2099. > > -Tim DeBenedictis
  2100. > > timmyd@netcom.com
  2101. > The simple answer is that there is no Apple-documented way of going over
  2102. > 57.6k on the serial ports.
  2103. > The harder answer is that there are controls calls you can make to put the
  2104. > SerialDMA driver into 230.4k mode, but not 115.2k.  According to David
  2105. > Schwarz (author of SerialSpeed 230) you must write to the Serial
  2106. > Controller Chip (SCC) directly to achieve 115.2k.
  2107. > Guess the full potential range of the serial ports will not be available
  2108. > until Copland?  I though OpenTransport would also provide some serial
  2109. > support, does anyone know if a future OT will provide higher rates?
  2110. > Rick
  2111.  
  2112.  
  2113. Sorry Rick,  there is a way.
  2114.  
  2115.  
  2116. Excerpt from the SerialDMA 2.0 reference....
  2117.  
  2118.  
  2119. The SerialDMA driver supports two new csCodes, 115 and 230, by which its Control 
  2120. routine can switch the driver to high-speed modes. These csCodes support 115.2K baud 
  2121. and 230.4K baud rates. The correct time to make these calls is after a normal 
  2122. SerReset call using some other (lower) baud rate. The reason for this is SerReset 
  2123. performs a number of configuration tasks but assumes that the baud rate is a function 
  2124. of the SCC baud rate generator. In order to achieve these two higher speeds, the baud 
  2125. rate generator must be bypassed, using the standard 3.672 MHz SCC clock and one of a 
  2126. very limited number of rate divisors. These csCodes effect the task of bypassing the 
  2127. baud rate generator and setting the clock divisor to achieve the specified rate.
  2128.  
  2129.  
  2130. Set 115.2K Baud Rate    [control code 115]
  2131. csCode = 115
  2132. This call is designed for high-speed modems. It typically requires DMA hardware on 
  2133. the receive channel to be successful. It is similar to the clock selection function 
  2134. available through csCode = 16, but it instead forces the serial driver to take its 
  2135. baud rate clock directly from the internal 3.672 MHz RTxC clock source with a rate 
  2136. multiplier of 32. The result is to force transmit and receive baud rates of nominally 
  2137. 115.2K baud. Other configuration parameters are not affected.
  2138.  
  2139. Set 230.4K Baud Rate    [control code 230]
  2140. csCode = 230
  2141. This call is designed for high-speed modems. It typically requires DMA hardware on 
  2142. the receive channel to be successful. It is similar to the clock selection function 
  2143. available through csCode = 16, but it instead forces the serial driver to take its 
  2144. baud rate clock directly from the internal 3.672 MHz RTxC clock source with a rate 
  2145. multiplier of 16. The result is to force transmit and receive baud rates of nominally 
  2146. 230.4K baud. Other configuration parameters are not affected.
  2147.  
  2148. +++++++++++++++++++++++++++
  2149.  
  2150. >From cardona@tradewave.com (Richard Cardona)
  2151. Date: Fri, 10 Nov 1995 08:33:35 -0600
  2152. Organization: TradeWave Corp.
  2153.  
  2154. In article <30A2A11E.4E82@moldev.com>, tom_smith@moldev.com wrote:
  2155.  
  2156. > Sorry Rick,  there is a way.
  2157.  
  2158. Hey I love being wrong when information to help us all is revealed! ;-),
  2159.  
  2160. > Excerpt from the SerialDMA 2.0 reference....
  2161. > The SerialDMA driver supports two new csCodes, 115 and 230, by which its
  2162. Control 
  2163. > routine can switch the driver to high-speed modes. These csCodes support
  2164. 115.2K baud 
  2165. > and 230.4K baud rates. 
  2166.  
  2167. Excellent! Now if every serial comm. author who fiddles with the SCC
  2168. directly can distribute the SerialDMA 2.0.x driver and use the appropriate
  2169. csCode codes we'll all be in hog heaven.
  2170.  
  2171. Rick
  2172.  
  2173. +++++++++++++++++++++++++++
  2174.  
  2175. >From ejensen@server.uwindsor.ca (Erik Jensen)
  2176. Date: Fri, 10 Nov 1995 17:42:56 GMT
  2177. Organization: University of Windsor
  2178.  
  2179. In article <30A2A11E.4E82@moldev.com>, tom_smith@moldev.com wrote:
  2180.  
  2181. >
  2182. >Excerpt from the SerialDMA 2.0 reference....
  2183. >
  2184. >
  2185. >The SerialDMA driver supports two new csCodes, 115 and 230, by which its
  2186. Control 
  2187. >routine can switch the driver to high-speed modes. These csCodes support
  2188. 115.2K baud 
  2189. >and 230.4K baud rates. The correct time to make these calls is after a normal 
  2190. >SerReset call using some other (lower) baud rate....
  2191.  
  2192. >
  2193. >Set 115.2K Baud Rate    [control code 115]
  2194. >csCode = 115
  2195. >This call is designed for high-speed modems. It typically requires DMA
  2196. hardware on 
  2197. >the receive channel to be successful. It is similar to the clock
  2198. selection function 
  2199. >available through csCode = 16, but it instead forces the serial driver to
  2200. take its 
  2201. >baud rate clock directly from the internal 3.672 MHz RTxC clock source
  2202. with a rate 
  2203. >multiplier of 32. The result is to force transmit and receive baud rates
  2204. of nominally 
  2205. >115.2K baud. Other configuration parameters are not affected.
  2206. >
  2207. >Set 230.4K Baud Rate    [control code 230]
  2208. >csCode = 230
  2209. >This call is designed for high-speed modems. It typically requires DMA
  2210. hardware on 
  2211. >the receive channel to be successful. It is similar to the clock
  2212. selection function 
  2213. >available through csCode = 16,...
  2214.  
  2215. Can anyone answer a couple more questions on this-
  2216. 1) Is there a gestalt for determining if the faster DMA serial driver is
  2217. available (eg. on AV Macs and PowerMacs)?
  2218.  
  2219. 2) csCode=16 corresponds to leaving DTR enabled after closing the driver
  2220. (according to my Think Reference)- is this really the right csCode? If so,
  2221. does it matter what the csParamPtr is pointing at (is this data used at
  2222. all for this call)?
  2223.  
  2224. Thanks,
  2225. Erik.
  2226. __________________________________________________________________________ 
  2227. Erik Jensen                                   ejensen@server.uwindsor.ca
  2228. Department of Physics                after Jan. 1/96 -> ejensen@unbc.edu
  2229. University of Windsor
  2230.  
  2231. We do not live to eat and make money.  We eat and make money to be able to  enjoy life.  That is what life means and what life is for -- George Mallory 
  2232. __________________________________________________________________________
  2233.  
  2234. ---------------------------
  2235.  
  2236. >From chris-b@cs.auckland.ac.nz (Chris Burns)
  2237. Subject: [Q] Macsbug ATB in PPC apps?
  2238. Date: Fri, 03 Nov 1995 13:11:58 +1300
  2239. Organization: HyperMedia Unit, Comp Sci, Auckland University
  2240.  
  2241. Hi all,
  2242.  
  2243. How do I set an ATB in a PPC native app? I've gor Macsbug 6.5.2 on a
  2244. PowerMac 8100/80 and tried (the obvious):
  2245.  
  2246. ATB InitGraf
  2247.  
  2248. but get no breaks.
  2249.  
  2250. What's the story?
  2251.  
  2252. TIA,
  2253.  
  2254. Chris B
  2255. - ---------------------------------------------------------------------
  2256. NewZealand:AucklandUniversity:ComputerScience:HyperMediaUnit:ChrisBurns
  2257. Internet: chris-b@cs.auckland.ac.nz
  2258. Phone:    +64 9 373-7599 x5602
  2259. Fax:      +64 9 373-7453                         Async, Therefore I Am.
  2260. - ---------------------------------------------------------------------
  2261.  
  2262. +++++++++++++++++++++++++++
  2263.  
  2264. >From dlyons@netcom.com (David A. Lyons)
  2265. Date: Thu, 9 Nov 1995 23:04:54 GMT
  2266. Organization: Netcom Online Communications Services (408-241-9760 login: guest)
  2267.  
  2268. In article <chris-b-0311951311580001@hmu104.hmu.auckland.ac.nz> chris-b@cs.auckland.ac.nz (Chris Burns) writes:
  2269. >How do I set an ATB in a PPC native app? I've gor Macsbug 6.5.2 on a
  2270. >PowerMac 8100/80 and tried (the obvious):
  2271. >
  2272. >ATB InitGraf
  2273. >
  2274. >but get no breaks.  What's the story?
  2275.  
  2276. Current MacsBug versions (6.5.2 is the latest) do not give you a great way
  2277. to break on PowerPC calls to arbitrary symbols, but there are several less-
  2278. than-great options:
  2279.  
  2280. --In the case of InitGraf, you can use the "atvb" (A-Trap vector break)
  2281.   dcmd, which is included in "PowerPC DCMDs" (put that file in your
  2282.   MacsBug Preferences folder, inside System Folder).
  2283.  
  2284. --If the symbol you want to break on in is RAM, you can put a PowerPC
  2285.   breakpoint there with BRP.  Use an Option-C for CFM to distinguish
  2286.   the PowerPC CFM symbol from the A-Trap of the same name:
  2287.       brp (Option-C)InitGraf
  2288.  
  2289. --BRP will also work if your symbol is in ROM, but *only* if you're
  2290.   already "in" PowerPC code (MacsBug must be showing PPC registers
  2291.   rather than 68K).
  2292.  
  2293. --Here's a strange-but-life-saving fallback technique for stuff in
  2294.   ROM:  Use FindSym to find the TVector that wil be used to jump to your
  2295.   symbol.  We will change the TVector to point at a few instructions in
  2296.   RAM which jump to the original location, and then put a breakpoint in RAM.
  2297.  
  2298.     SL PlayMem PPCJump tvector_address^
  2299.     SL tvector_address PlayMem
  2300.     BRP PlayMem
  2301.  
  2302. The PPCJump macro creates a 4-instruction sequence:  lis r0,0xYYYY;
  2303. ori r0,r0,0xZZZZ; mtctr r0; bctr.  If there's a way to do this without
  2304. taking 16 bytes & trashing two registers, please let me in on the secret.
  2305.  
  2306. If the address happens to be in the first or last 32M of the address
  2307. space (which includes the ROM on the recent PCI machines), you can
  2308. use the PPCJumpA macro, which creates a single "ba" instruction.
  2309. [For examples, try "dhp PPCJump FFC00000" and "dhp PPCJumpA FFC00000".]
  2310.  
  2311. --Dave (Dr MacsBug's assistant)
  2312.   Mr Tangent
  2313.  
  2314. -- 
  2315. Dave Lyons
  2316. Mr Tangent
  2317.  
  2318.  
  2319. ---------------------------
  2320.  
  2321. End of C.S.M.P. Digest
  2322. **********************
  2323.